From 87432470f33ac17f643f67dc109c8accfc530f54 Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Sat, 13 Feb 2010 14:54:19 +0000 Subject: [PATCH] Fix a crash in 'Copy to spare:Palette' when both images have different height. Fix Lua which didin't report useful message when an error was detected. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1337 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- factory.c | 5 +++-- pages.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/factory.c b/factory.c index d4666157..ee6f9514 100644 --- a/factory.c +++ b/factory.c @@ -809,8 +809,9 @@ void Button_Brush_Factory(void) } else if (lua_pcall(L, 0, 0, 0) != 0) { - message = lua_tostring(L, 1); - if(message) + int stack_size; + stack_size= lua_gettop(L); + if (stack_size>0 && (message = lua_tostring(L, stack_size))!=NULL) Verbose_error_message(message); else Warning_message("Unknown error running script!"); diff --git a/pages.c b/pages.c index 7ba40e6d..9abe14a9 100644 --- a/pages.c +++ b/pages.c @@ -283,7 +283,7 @@ void Redraw_spare_image(void) // Copy it in Spare_visible_image memcpy(Spare_visible_image.Image, Spare_backups->Pages->Image[layer], - Spare_image_width*Main_image_height); + Spare_image_width*Spare_image_height); // No depth buffer in the spare //memset(Spare_visible_image_depth_buffer.Image,