aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2018-02-08 08:57:10 -0600
committerRob Landley <rob@landley.net>2018-02-08 08:57:10 -0600
commit24c63d1dd238ed762297786dbd2912f0bbaf941a (patch)
treeadfe311368d0797a53682409fa7f57ebaaa71d04
parent29fb63849d4d49bc5afda2b6562faca3e4791ac4 (diff)
downloadtoybox-24c63d1dd238ed762297786dbd2912f0bbaf941a.tar.gz
Thinko pointed out by Andreas Gampe (causing segfaults in top, oops).
-rw-r--r--toys/posix/ps.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/ps.c b/toys/posix/ps.c
index fd9b54bc..8ee68ad6 100644
--- a/toys/posix/ps.c
+++ b/toys/posix/ps.c
@@ -1417,7 +1417,7 @@ static void top_common(
mix.count = 0;
while (old.count || new.count) {
- struct carveup *otb = *old.tb, *ntb = *new.tb;
+ struct carveup *otb = old.tb ? *old.tb : 0, *ntb = new.tb ? *new.tb : 0;
// If we just have old for this process, it exited. Discard it.
if (old.count && (!new.count || *otb->slot < *ntb->slot)) {