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 <benwill...@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*

Reply via email to