@@ -672,29 +672,32 @@ void MCB_parsewatches(MCExecContext& ctxt, MCStringRef p_input)
672672 if (t_success)
673673 t_success = MCStringDivideAtChar (*t_watch, ' ,' , kMCCompareExact , &t_obj, &t_obj_tail);
674674
675- MCAutoStringRef t_express;
676- MCAutoStringRef t_express_tail;
675+ // SN-2014-09-18: [[ Bug 13453 ]] The input is object, handler, variable, condition
676+ MCAutoStringRef t_hname;
677+ MCAutoStringRef t_hname_tail;
677678
678679 if (t_success)
679- t_success = MCStringDivideAtChar (*t_obj_tail, ' ,' , kMCCompareExact , &t_express , &t_express_tail );
680+ t_success = MCStringDivideAtChar (*t_obj_tail, ' ,' , kMCCompareExact , &t_hname , &t_hname_tail );
680681
681682 MCAutoStringRef t_vname;
682- MCAutoStringRef t_hname ;
683+ MCAutoStringRef t_express ;
683684
684685 if (t_success)
685- t_success = MCStringDivideAtChar (*t_express_tail , ' ,' , kMCCompareExact , &t_vname, &t_hname );
686+ t_success = MCStringDivideAtChar (*t_hname_tail , ' ,' , kMCCompareExact , &t_vname, &t_express );
686687
687688 MCObjectPtr t_object;
688689
690+ // SN-2014-09-18: [[ Bug 13453 ]] With an empty string (no watchedVariables anymore), TryToResolveObject fails
689691 if (t_success)
690- {
691- MCInterfaceTryToResolveObject (ctxt, *t_obj, t_object);
692-
692+ t_success = MCInterfaceTryToResolveObject (ctxt, *t_obj, t_object);
693+
694+ if (t_success)
695+ {
693696 // OK-2010-01-14: [[Bug 6506]] - Allow globals in watchedVariables
694697 // If the object and handler are empty we assume its a global, otherwise
695698 // do the previous behavior.
696699
697- if (MCStringGetLength (*t_obj) == 0 && MCStringGetLength (*t_hname) == 0 ||
700+ if (( MCStringGetLength (*t_obj) == 0 && MCStringGetLength (*t_hname) == 0 ) ||
698701 t_object . object != nil)
699702 {
700703 Watchvar *t_new_watches;
@@ -754,10 +757,9 @@ bool MCB_unparsewatches(MCStringRef &r_watches)
754757 if (t_success)
755758 t_success = MCListAppend (*t_watched_var, MCwatchedvars[i].varname );
756759
757- if (t_success && MCwatchedvars[i]. expression != nil && ! MCStringIsEmpty (MCwatchedvars[i]. expression ))
758- {
760+ // SN-2014-09-18: [[ Bug 13453 ]] A watched variable's expression is never nil
761+ if (t_success)
759762 t_success = MCListAppend (*t_watched_var, MCwatchedvars[i].expression );
760- }
761763
762764 if (t_success)
763765 t_success = MCListAppend (*t_watches_list, *t_watched_var);
0 commit comments