diff options
Diffstat (limited to 'apps/plugins/lua/rocklib.c')
-rw-r--r-- | apps/plugins/lua/rocklib.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c index 050fbc73b2..2672d446fc 100644 --- a/apps/plugins/lua/rocklib.c +++ b/apps/plugins/lua/rocklib.c | |||
@@ -153,7 +153,7 @@ RB_WRAP(kbd_input) | |||
153 | 153 | ||
154 | const char *input = lua_tostring(L, 1); | 154 | const char *input = lua_tostring(L, 1); |
155 | size_t layout_len; | 155 | size_t layout_len; |
156 | const char *layout = lua_tolstring(L, 2, &layout_len); | 156 | const unsigned char *layout = lua_tolstring(L, 2, &layout_len); |
157 | char *buffer = luaL_prepbuffer(&b); | 157 | char *buffer = luaL_prepbuffer(&b); |
158 | 158 | ||
159 | if(input != NULL) | 159 | if(input != NULL) |
@@ -161,8 +161,12 @@ RB_WRAP(kbd_input) | |||
161 | else | 161 | else |
162 | buffer[0] = '\0'; | 162 | buffer[0] = '\0'; |
163 | 163 | ||
164 | if(layout_len <= 1 || (unsigned short)layout[layout_len - 1] != 0xFFFE) | 164 | if(layout_len <= 2 || |
165 | layout[layout_len - 1] != 0xFE || | ||
166 | layout[layout_len - 2] != 0xFF) | ||
167 | { | ||
165 | layout = NULL; | 168 | layout = NULL; |
169 | } | ||
166 | 170 | ||
167 | if(!rb->kbd_input(buffer, LUAL_BUFFERSIZE, (unsigned short *)layout)) | 171 | if(!rb->kbd_input(buffer, LUAL_BUFFERSIZE, (unsigned short *)layout)) |
168 | { | 172 | { |