@@ -530,30 +530,35 @@ void MCB_parsebreaks(MCExecContext& ctxt, MCStringRef p_input)
530530
531531 if (t_success)
532532 t_success = MCStringDivideAtIndex (*t_break, t_offset, &t_head, &t_tail);
533-
534- if (t_success)
535- t_success = MCInterfaceTryToResolveObject (ctxt, *t_head, t_object);
536533
537534 MCAutoStringRef t_line_string;
538535 MCAutoStringRef t_info;
539536
540537 if (t_success)
541538 t_success = MCStringDivideAtChar (*t_tail, ' ,' , kMCCompareExact , &t_line_string, &t_info);
542539
540+ // AL-2015-07-31: [[ Bug 15822 ]] Don't abort parsing if a given line is not correctly formatted
541+ bool t_valid_break;
542+ t_valid_break = t_success;
543+
544+ if (t_valid_break)
545+ t_valid_break = MCInterfaceTryToResolveObject (ctxt, *t_head, t_object);
546+
543547 int32_t t_line;
544-
545- if (t_success)
546- t_success = MCU_strtol (*t_line_string, t_line);
547-
548- if (t_success && t_line > 0 )
548+ t_line = 0 ;
549+
550+ if (t_valid_break)
551+ t_valid_break = MCU_strtol (*t_line_string, t_line) && t_line > 0 ;
552+
553+ if (t_valid_break)
549554 {
550555 Breakpoint *t_new_breakpoints;
551556 t_new_breakpoints = (Breakpoint *)realloc (MCbreakpoints, sizeof (Breakpoint) * (MCnbreakpoints + 1 ));
552557 if (t_new_breakpoints != nil)
553558 {
554559 MCbreakpoints = t_new_breakpoints;
555560 MCbreakpoints[MCnbreakpoints] . object = t_object . object;
556- MCbreakpoints[MCnbreakpoints] . line = t_line;
561+ MCbreakpoints[MCnbreakpoints] . line = ( uint32_t ) t_line;
557562 MCbreakpoints[MCnbreakpoints] . info = MCValueRetain (*t_info);
558563 MCnbreakpoints++;
559564 }
@@ -696,19 +701,22 @@ void MCB_parsewatches(MCExecContext& ctxt, MCStringRef p_input)
696701 if (t_success)
697702 t_success = MCStringDivideAtChar (*t_hname_tail, ' ,' , kMCCompareExact , &t_vname, &t_express);
698703
704+ // AL-2015-07-31: [[ Bug 15822 ]] Don't abort parsing if a given line is not correctly formatted
705+ bool t_valid_watch;
706+ t_valid_watch = t_success;
707+
699708 MCObjectPtr t_object;
700-
701709 // SN-2014-09-18: [[ Bug 13453 ]] With an empty string (no watchedVariables anymore), TryToResolveObject fails
702- if (t_success )
703- t_success = MCInterfaceTryToResolveObject (ctxt, *t_obj, t_object);
710+ if (t_valid_watch )
711+ t_valid_watch = MCInterfaceTryToResolveObject (ctxt, *t_obj, t_object);
704712
705- if (t_success )
713+ if (t_valid_watch )
706714 {
707715 // OK-2010-01-14: [[Bug 6506]] - Allow globals in watchedVariables
708716 // If the object and handler are empty we assume its a global, otherwise
709717 // do the previous behavior.
710718
711- if ((MCStringGetLength (*t_obj) == 0 && MCStringGetLength (*t_hname) == 0 ) ||
719+ if ((MCStringIsEmpty (*t_obj) && MCStringIsEmpty (*t_hname)) ||
712720 t_object . object != nil)
713721 {
714722 Watchvar *t_new_watches;
0 commit comments