Skip to content

Commit d62c551

Browse files
author
livecodeali
committed
[ CID 114564 ] Fix potential nil pointer dereference
1 parent b91f4fa commit d62c551

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

engine/src/cmdsf.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,16 +1415,19 @@ void MCExport::exec_ctxt(MCExecContext &ctxt)
14151415

14161416
if (sformat == EX_OBJECT)
14171417
{
1418+
if (image == nil)
1419+
{
1420+
ctxt . LegacyThrow(EE_EXPORT_NOTANIMAGE);
1421+
return;
1422+
}
1423+
14181424
MCObject *optr = NULL;
1419-
if (image != NULL)
1425+
//get image from chunk
1426+
uint4 parid;
1427+
if (!image->getobj(ctxt, optr, parid, True))
14201428
{
1421-
//get image from chunk
1422-
uint4 parid;
1423-
if (!image->getobj(ctxt, optr, parid, True))
1424-
{
1425-
ctxt . LegacyThrow(EE_EXPORT_NOSELECTED);
1426-
return;
1427-
}
1429+
ctxt . LegacyThrow(EE_EXPORT_NOSELECTED);
1430+
return;
14281431
}
14291432

14301433
MCAutoArrayRef t_array;

0 commit comments

Comments
 (0)