AnalogTerm2: Check ttys != NULL in SIGCHLD handler.
authorMatthew Mondor <mmondor@pulsar-zone.net>
Tue, 13 Jun 2023 11:44:05 +0000 (11:44 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Tue, 13 Jun 2023 11:44:05 +0000 (11:44 +0000)
mmsoftware/analogterm2/src/tty.c

index c198ae7..86f452b 100644 (file)
@@ -135,10 +135,10 @@ sighandler(int sig)
                                warn("Shell subprocess %d exit status: %d %s",
                                     (int)pid, WEXITSTATUS(status),
                                     strerror(WEXITSTATUS(status)));
-                       if (pid == ttys->shell_pid)
+                       if (ttys != NULL && pid == ttys->shell_pid)
                                ttys->shell_pid = -1;
                }
-               if (ttys->shell_pid == -1) {
+               if (ttys != NULL && ttys->shell_pid == -1) {
                        warn("Shell subprocess gone.");
                        shell_done = true;
                }