diff options
Diffstat (limited to 'apps/plugins/lua')
-rw-r--r-- | apps/plugins/lua/rocklib.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c index ca77d5ea8f..73c3851bc1 100644 --- a/apps/plugins/lua/rocklib.c +++ b/apps/plugins/lua/rocklib.c | |||
@@ -330,12 +330,11 @@ RB_WRAP(lcd_get_backdrop) | |||
330 | { | 330 | { |
331 | fb_data* backdrop = rb->lcd_get_backdrop(); | 331 | fb_data* backdrop = rb->lcd_get_backdrop(); |
332 | if(backdrop == NULL) | 332 | if(backdrop == NULL) |
333 | return 0; | 333 | lua_pushnil(L); |
334 | else | 334 | else |
335 | { | ||
336 | rli_wrap(L, backdrop, LCD_WIDTH, LCD_HEIGHT); | 335 | rli_wrap(L, backdrop, LCD_WIDTH, LCD_HEIGHT); |
337 | return 1; | 336 | |
338 | } | 337 | return 1; |
339 | } | 338 | } |
340 | #endif /* LCD_DEPTH > 1 */ | 339 | #endif /* LCD_DEPTH > 1 */ |
341 | 340 | ||
@@ -478,24 +477,28 @@ RB_WRAP(read_bmp_file) | |||
478 | if(result > 0) | 477 | if(result > 0) |
479 | { | 478 | { |
480 | bm.data = (unsigned char*) rli_alloc(L, bm.width, bm.height); | 479 | bm.data = (unsigned char*) rli_alloc(L, bm.width, bm.height); |
481 | rb->read_bmp_file(filename, &bm, result, format, NULL); | 480 | if(rb->read_bmp_file(filename, &bm, result, format, NULL) < 0) |
482 | 481 | { | |
483 | return 1; | 482 | /* Error occured, drop newly allocated image from stack */ |
483 | lua_pop(L, 1); | ||
484 | lua_pushnil(L); | ||
485 | } | ||
484 | } | 486 | } |
487 | else | ||
488 | lua_pushnil(L); | ||
485 | 489 | ||
486 | return 0; | 490 | return 1; |
487 | } | 491 | } |
488 | 492 | ||
489 | RB_WRAP(current_path) | 493 | RB_WRAP(current_path) |
490 | { | 494 | { |
491 | const char *current_path = get_current_path(L, 1); | 495 | const char *current_path = get_current_path(L, 1); |
492 | if(current_path != NULL) | 496 | if(current_path != NULL) |
493 | { | ||
494 | lua_pushstring(L, current_path); | 497 | lua_pushstring(L, current_path); |
495 | return 1; | ||
496 | } | ||
497 | else | 498 | else |
498 | return 0; | 499 | lua_pushnil(L); |
500 | |||
501 | return 1; | ||
499 | } | 502 | } |
500 | 503 | ||
501 | static void fill_text_message(lua_State *L, struct text_message * message, | 504 | static void fill_text_message(lua_State *L, struct text_message * message, |