Don't segfaut when the parent of the layout cell is NULL; also assign the
lc->parent component to a common variable and use that throughout this
function.
---
 window.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/window.c b/window.c
index 1dd70c4..f25f64e 100644
--- a/window.c
+++ b/window.c
@@ -420,10 +420,13 @@ 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;
+
+       if ((lcparent = nextwp->layout_cell->parent) == 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,7 +435,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;
+               lc2 = lcparent;
                for (; lc2 != NULL; lc2 = lc2->parent) {
                        if (lc == lc2)
                                return;
-- 
1.8.4.rc2


------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to