@@ -456,7 +456,7 @@ update_file_1 (struct file *file, unsigned int depth,
456456 }
457457
458458 DBF (DB_VERBOSE , _ ("File '%s' was considered already.\n" ));
459- p_stack_top = p_stack_top -> p_parent ;
459+ p_stack_top = p_stack_top ? p_stack_top -> p_parent : NULL ;
460460 trace_pop_target (p_call_stack );
461461 return 0 ;
462462 }
@@ -468,12 +468,12 @@ update_file_1 (struct file *file, unsigned int depth,
468468 break ;
469469 case cs_running :
470470 DBF (DB_VERBOSE , _ ("Still updating file '%s'.\n" ));
471- p_stack_top = p_stack_top -> p_parent ;
471+ p_stack_top = p_stack_top ? p_stack_top -> p_parent : NULL ;
472472 trace_pop_target (p_call_stack );
473473 return 0 ;
474474 case cs_finished :
475475 DBF (DB_VERBOSE , _ ("Finished updating file '%s'.\n" ));
476- p_stack_top = p_stack_top -> p_parent ;
476+ p_stack_top = p_stack_top ? p_stack_top -> p_parent : NULL ;
477477 trace_pop_target (p_call_stack );
478478 return file -> update_status ;
479479 default :
@@ -710,7 +710,7 @@ update_file_1 (struct file *file, unsigned int depth,
710710 set_command_state (file , cs_deps_running );
711711 -- depth ;
712712 DBF (DB_VERBOSE , _ ("The prerequisites of '%s' are being made.\n" ));
713- p_stack_top = p_stack_top -> p_parent ;
713+ p_stack_top = p_stack_top ? p_stack_top -> p_parent : NULL ;
714714 trace_pop_target (p_call_stack );
715715 return 0 ;
716716 }
@@ -732,7 +732,7 @@ update_file_1 (struct file *file, unsigned int depth,
732732 OS (error , NILF ,
733733 _ ("Target '%s' not remade because of errors." ), file -> name );
734734
735- p_stack_top = p_stack_top -> p_parent ;
735+ p_stack_top = p_stack_top ? p_stack_top -> p_parent : NULL ;
736736 trace_pop_target (p_call_stack );
737737 return dep_status ;
738738 }
@@ -843,7 +843,7 @@ update_file_1 (struct file *file, unsigned int depth,
843843 }
844844
845845 notice_finished_file (file );
846- p_stack_top = p_stack_top -> p_parent ;
846+ p_stack_top = p_stack_top ? p_stack_top -> p_parent : NULL ;
847847 trace_pop_target (p_call_stack );
848848
849849 /* Since we don't need to remake the file, convert it to use the
@@ -877,7 +877,7 @@ update_file_1 (struct file *file, unsigned int depth,
877877 DBF (DB_VERBOSE , _ ("Recipe of '%s' is being run.\n" ));
878878 if ( file -> tracing & BRK_AFTER_CMD || i_debugger_stepping )
879879 enter_debugger (p_call_stack , file , 0 , DEBUG_BRKPT_AFTER_CMD );
880- p_stack_top = p_stack_top -> p_parent ;
880+ p_stack_top = p_stack_top ? p_stack_top -> p_parent : NULL ;
881881 trace_pop_target (p_call_stack );
882882 return 0 ;
883883 }
@@ -901,7 +901,7 @@ update_file_1 (struct file *file, unsigned int depth,
901901 if ( file -> tracing & BRK_AFTER_CMD || i_debugger_stepping )
902902 enter_debugger (p_call_stack , file , 0 , DEBUG_BRKPT_AFTER_CMD );
903903
904- p_stack_top = p_stack_top -> p_parent ;
904+ p_stack_top = p_stack_top ? p_stack_top -> p_parent : NULL ;
905905 trace_pop_target (p_call_stack );
906906 return file -> update_status ;
907907}
0 commit comments