shithub: riscv

Download patch

ref: cafcffb1dce89b7e10ddd9149e4b0928ac2b9b38
parent: 62b3eea2715a9e67cdb0873faa0d802344bf7683
author: jpathy <[email protected]>
date: Tue Sep 24 11:50:35 EDT 2013

fix null dereference crash in mothra

--- a/sys/src/cmd/mothra/mothra.c
+++ b/sys/src/cmd/mothra/mothra.c
@@ -1016,9 +1016,11 @@
 			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);