From cafcffb1dce89b7e10ddd9149e4b0928ac2b9b38 Mon Sep 17 00:00:00 2001 From: jpathy Date: Tue, 24 Sep 2013 15:50:35 -0700 Subject: [PATCH] fix null dereference crash in mothra --- sys/src/cmd/mothra/mothra.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/src/cmd/mothra/mothra.c b/sys/src/cmd/mothra/mothra.c index c6457f547..29e9219fd 100644 --- a/sys/src/cmd/mothra/mothra.c +++ b/sys/src/cmd/mothra/mothra.c @@ -1016,9 +1016,11 @@ mothon(Www *w, int on) plrtstr(&t->next, 0, 0, t->font, strdup("->"), PL_HOT, ap); t->next->next = x; } else { - t->next = x->next; - x->next = nil; - freetext(x); + if(x) { + t->next = x->next; + x->next = nil; + freetext(x); + } } } updtext(w);