diff --git a/docs/notes/bugfix-11950.md b/docs/notes/bugfix-11950.md new file mode 100644 index 00000000000..eda87fe636d --- /dev/null +++ b/docs/notes/bugfix-11950.md @@ -0,0 +1 @@ +# mark card does not work \ No newline at end of file diff --git a/engine/src/cmds.cpp b/engine/src/cmds.cpp index 5d9decd4dca..424a687526b 100644 --- a/engine/src/cmds.cpp +++ b/engine/src/cmds.cpp @@ -1096,32 +1096,41 @@ void MCMarking::exec_ctxt(MCExecContext &ctxt) else MCInterfaceExecUnmarkCard(ctxt, t_object); } - if (tofind == nil) - if (mark) + // SN-2014-03-21 [[ Bug 11950 ]]: 'mark' shouldn't throw an error when failing to mark when card is nil + // Any error set is discarded in the end of this block - unless is was triggered by a bad string. + else + { + if (tofind == nil) { - if (where != nil) - MCInterfaceExecMarkCardsConditional(ctxt, where); + if (mark) + { + if (where != nil) + MCInterfaceExecMarkCardsConditional(ctxt, where); + else + MCInterfaceExecMarkAllCards(ctxt); + } else - MCInterfaceExecMarkAllCards(ctxt); + { + if (where != nil) + MCInterfaceExecUnmarkCardsConditional(ctxt, where); + else + MCInterfaceExecUnmarkAllCards(ctxt); + } } else { - if (where != nil) - MCInterfaceExecUnmarkCardsConditional(ctxt, where); + MCAutoStringRef t_needle; + + if (!ctxt . EvalExprAsStringRef(tofind, EE_MARK_BADSTRING, &t_needle)) + return; + + if (mark) + MCInterfaceExecMarkFind(ctxt, mode, *t_needle, field); else - MCInterfaceExecUnmarkAllCards(ctxt); + MCInterfaceExecUnmarkFind(ctxt, mode, *t_needle, field); } - else - { - MCAutoStringRef t_needle; - - if (!ctxt . EvalExprAsStringRef(tofind, EE_MARK_BADSTRING, &t_needle)) - return; - - if (mark) - MCInterfaceExecMarkFind(ctxt, mode, *t_needle, field); - else - MCInterfaceExecUnmarkFind(ctxt, mode, *t_needle, field); + + ctxt . IgnoreLastError(); } }