summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Paisley <paisley@rpaisley.com>2010-01-31 11:24:47 -0800
committerShawn Betts <sabetts@Woaaahdudelike.local>2010-01-31 11:24:47 -0800
commit123abf526df35cb6eed59e13516bea653a065873 (patch)
treee3c65e8a8b5134445a4c877c215c8ee7892dd6f5
parentfde3d5537776664284cab59f521a898ccb456893 (diff)
downloadratpoison-123abf526df35cb6eed59e13516bea653a065873.zip
cother/iother Segfault patch
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. This patch resolves the issue.
-rw-r--r--src/actions.c10
1 files changed, 6 insertions, 4 deletions
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);