diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2014-03-06 13:01:51 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2014-03-06 13:01:51 +0000 |
commit | 78e783e7863eb33981da4a5ad48dd9e2aa2b08dd (patch) | |
tree | 3dd6a49f7add0af929ba79b64f1c6151e9dc8ca2 | |
parent | cbd360b7dd1f2ca1a3208d3e19af84e0e536f6b9 (diff) | |
download | rtmux-78e783e7863eb33981da4a5ad48dd9e2aa2b08dd.tar.gz rtmux-78e783e7863eb33981da4a5ad48dd9e2aa2b08dd.tar.bz2 rtmux-78e783e7863eb33981da4a5ad48dd9e2aa2b08dd.zip |
Don't segfaut when the parent of the layout cell is NULL, from Thomas Adam.
-rw-r--r-- | window.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -420,10 +420,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, @@ -432,8 +437,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; } |