ratpoison-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RP] cother/iother Segfault patch


From: Rob Paisley
Subject: [RP] cother/iother Segfault patch
Date: Fri, 29 Jan 2010 09:45:32 -0500
User-agent: Mutt/1.5.18 (2008-05-17)

As reported by "Gentooer" in the #ratpoison IRC channel, there is a bug in
:cother and :iother.  If are no windows and you issue either :cother, or
:iother ratpoison segfaults.  The following patch resolves this issue.

diff --git a/src/actions.c b/src/actions.c
index b9116dd..d7b64eb 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -5678,10 +5678,11 @@ cmd_iprev (int interactive, struct cmdarg **args)
 cmdret *
 cmd_cother (int interactive UNUSED, struct cmdarg **args UNUSED)
 {
-  rp_window *cur, *w;
+  rp_window *cur, *w = NULL;
 
   cur = current_window();
-  w = group_last_window_by_class (rp_current_group, cur->res_class);
+  if (cur)
+    w = group_last_window_by_class (rp_current_group, cur->res_class);
 
   if (!w)
     return cmdret_new (RET_FAILURE, "%s", MESSAGE_NO_OTHER_WINDOW);
@@ -5694,10 +5695,11 @@ cmd_cother (int interactive UNUSED, struct cmdarg 
**args UNUSED)
 cmdret *
 cmd_iother (int interactive UNUSED, struct cmdarg **args UNUSED)
 {
-  rp_window *cur, *w;
+  rp_window *cur, *w = NULL;
 
   cur = current_window();
-  w = group_last_window_by_class_complement (rp_current_group, cur->res_class);
+  if (cur)
+    w = group_last_window_by_class_complement (rp_current_group, 
cur->res_class);
 
   if (!w)
     return cmdret_new (RET_FAILURE, "%s", MESSAGE_NO_OTHER_WINDOW);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]