Skip to content

Commit af429c4

Browse files
author
runrevali
committed
[[ Bug 13804 ]] Crash freeing invalid palette struct
1 parent 73d2e7e commit af429c4

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

docs/notes/bugfix-13804.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# export snapshot crashes LC7GM 1

engine/src/cmdsf.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,9 +1469,14 @@ void MCExport::exec_ctxt(MCExecContext &ctxt)
14691469
t_settings_ptr = &t_settings;
14701470
break;
14711471
case kMCImagePaletteTypeEmpty:
1472+
t_settings . type = kMCImagePaletteTypeEmpty;
14721473
break;
14731474
}
14741475

1476+
// AL-2014-10-27: [[ Bug 13804 ]] Make sure execution stops here if there was an error creating palette settings
1477+
if (ctxt . HasError())
1478+
return;
1479+
14751480
bool t_success;
14761481
t_success = true;
14771482
if (sformat == EX_SNAPSHOT)
@@ -1537,9 +1542,6 @@ void MCExport::exec_ctxt(MCExecContext &ctxt)
15371542

15381543
MCInterfaceImagePaletteSettingsFree(ctxt, t_settings);
15391544

1540-
if (ctxt . HasError())
1541-
return;
1542-
15431545
if (*t_return_data != nil)
15441546
{
15451547
dest->set(ctxt, PT_INTO, *t_return_data);

0 commit comments

Comments
 (0)