Fix a stupid segfault caused by dereferencing a NULL ptr.
authorEric Andersen <andersen@codepoet.org>
Tue, 8 May 2001 04:25:46 +0000 (04:25 -0000)
committerEric Andersen <andersen@codepoet.org>
Tue, 8 May 2001 04:25:46 +0000 (04:25 -0000)
 -Erik

hush.c
shell/hush.c

diff --git a/hush.c b/hush.c
index a5f634b9a81f97d5bff6e8602238ab48afb60b6f..1cb5f39abd37b9fa81248454a723fb8781ae6f01 100644 (file)
--- a/hush.c
+++ b/hush.c
@@ -1162,6 +1162,8 @@ static void checkjobs()
                                remove_bg_job(pi);
                        }
                } else {
+                       if(pi==NULL)
+                               break;
                        /* child stopped */
                        pi->stopped_progs++;
                        pi->progs[prognum].is_stopped = 1;
index a5f634b9a81f97d5bff6e8602238ab48afb60b6f..1cb5f39abd37b9fa81248454a723fb8781ae6f01 100644 (file)
@@ -1162,6 +1162,8 @@ static void checkjobs()
                                remove_bg_job(pi);
                        }
                } else {
+                       if(pi==NULL)
+                               break;
                        /* child stopped */
                        pi->stopped_progs++;
                        pi->progs[prognum].is_stopped = 1;