[wmii] Segfault in wimenu

From: Ben Willard <benwillard_AT_gmail.com>
Date: Sat, 11 Apr 2009 17:17:27 -0400

In the tip, wimenu segfaults during the history dump when the first line
of the history file is chosen. This patch fixes it.

--
Ben
# HG changeset patch
# User Ben Willard <benwillard_AT_gmail.com>
# Date 1239483774 14400
# Node ID b2bc0a87701734f71abb0239391287e79c2e88a5
# Parent  5199ba1fbe688375507aa1c908f0bc455cb6298b
Fix a segfault in wimenu when doing a history dump
diff -r 5199ba1fbe68 -r b2bc0a877017 cmd/menu/history.c
--- a/cmd/menu/history.c	Fri Apr 03 18:59:23 2009 -0400
+++ b/cmd/menu/history.c	Sat Apr 11 17:02:54 2009 -0400
@@ -8,8 +8,10 @@
 
 static void
 splice(Item *i) {
-	i->next->prev = i->prev;
-	i->prev->next = i->next;
+	if(i->next != nil) 
+		i->next->prev = i->prev;
+	if(i->prev != nil)
+		i->prev->next = i->next;
 }
 
 char*
Received on Sat Apr 11 2009 - 21:17:27 UTC

This archive was generated by hypermail 2.2.0 : Sat Apr 11 2009 - 21:24:06 UTC