Re: [wmii] Segfault in wimenu

2009-04-11 Thread Kris Maglione

On Sat, Apr 11, 2009 at 05:17:27PM -0400, Ben Willard wrote:

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


Thanks, applied.

--
Kris Maglione

A programmer is a person who passes as an exacting expert on the basis
of being able to turn out, after innumerable punching, an infinite
series of incomprehensive answers calculated with micrometric
precisions from vague assumptions based on debatable figures taken
from inconclusive documents and carried out on instruments of
problematical accuracy by persons of dubious reliability and
questionable mentality for the avowed purpose of annoying and
confounding a hopelessly defenseless department that was unfortunate
enough to ask for the information in the first place.
--IEEE Grid newsmagazine




[wmii] Segfault in wimenu

2009-04-11 Thread Ben Willard
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 
# 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.cFri Apr 03 18:59:23 2009 -0400
+++ b/cmd/menu/history.cSat 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*