diff options
author | Rob Paisley <paisley@rpaisley.com> | 2010-01-31 11:24:47 -0800 |
---|---|---|
committer | Shawn Betts <sabetts@Woaaahdudelike.local> | 2010-01-31 11:24:47 -0800 |
commit | 123abf526df35cb6eed59e13516bea653a065873 (patch) | |
tree | e3c65e8a8b5134445a4c877c215c8ee7892dd6f5 /src/actions.c | |
parent | fde3d5537776664284cab59f521a898ccb456893 (diff) | |
download | ratpoison-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.
Diffstat (limited to 'src/actions.c')
-rw-r--r-- | src/actions.c | 10 |
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); |