diff options
author | nicm <nicm> | 2014-03-31 21:41:07 +0000 |
---|---|---|
committer | nicm <nicm> | 2014-03-31 21:41:07 +0000 |
commit | 1704d4a6b799525f510860919b8c8c4315154a05 (patch) | |
tree | 99d4f2b45da1c7f20055d5aef83df09774aec901 /window.c | |
parent | 46593e7aa26b83f0ba1b0d36a700d7158ac2b178 (diff) | |
download | rtmux-1704d4a6b799525f510860919b8c8c4315154a05.tar.gz rtmux-1704d4a6b799525f510860919b8c8c4315154a05.tar.bz2 rtmux-1704d4a6b799525f510860919b8c8c4315154a05.zip |
Don't segfaut when the parent of the layout cell is NULL, from Thomas Adam.
Diffstat (limited to 'window.c')
-rw-r--r-- | window.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -423,10 +423,15 @@ window_pane_active_set(struct window_pane *wp, struct window_pane *nextwp) void window_pane_active_lost(struct window_pane *wp, struct window_pane *nextwp) { - struct layout_cell *lc, *lc2; + struct layout_cell *lc, *lc2, *lcparent; + + /* Get the parent cell. */ + lcparent = nextwp->layout_cell->parent; + if (lcparent == NULL) + return; /* Save the target pane in its parent. */ - nextwp->layout_cell->parent->lastwp = nextwp; + lcparent->lastwp = nextwp; /* * Save the source pane in all of its parents up to, but not including, @@ -435,8 +440,7 @@ window_pane_active_lost(struct window_pane *wp, struct window_pane *nextwp) if (wp == NULL) return; for (lc = wp->layout_cell->parent; lc != NULL; lc = lc->parent) { - lc2 = nextwp->layout_cell->parent; - for (; lc2 != NULL; lc2 = lc2->parent) { + for (lc2 = lcparent; lc2 != NULL; lc2 = lc2->parent) { if (lc == lc2) return; } |