Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit cfef977

Browse files
committed
[[ Bug 22711 ]] Fix crash when calling copy on non-field text chunk
This patch fixes a crash when calling copy on non-field text chunk. Now a suitable error is thrown if this is the case.
1 parent b527ae8 commit cfef977

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

docs/notes/bugfix-22711.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Fix crash when calling the `copy` command with a text chunk of a non-field object

engine/src/cmdsc.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@ void MCClipboardCmd::exec_ctxt(MCExecContext& ctxt)
185185
return;
186186
}
187187

188+
if (t_obj_chunk . object -> gettype() != CT_FIELD)
189+
{
190+
ctxt . LegacyThrow(EE_CHUNK_BADCONTAINER);
191+
return;
192+
}
193+
188194
if (iscut())
189195
MCPasteboardExecCutTextToClipboard(ctxt, t_obj_chunk);
190196
else

0 commit comments

Comments
 (0)