From 1dd344b2f8a3e50e59cf3e0238f02fcf44707018 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Thu, 26 Jun 2014 03:49:47 -0400 Subject: [PATCH] Fixed Space() causing panics during size calculations. --- grid.go | 6 +++++- stack.go | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/grid.go b/grid.go index a298834..53c7d35 100644 --- a/grid.go +++ b/grid.go @@ -188,7 +188,11 @@ _=ymargin if current != nil { // connect first left to first right current.neighbor = c } - current = as[0] // next left is first subwidget + if len(as) != 0 { + current = as[0] // next left is first subwidget + } else { + current = nil // spaces don't have allocation data + } allocations = append(allocations, as...) x += g.colwidths[col] } diff --git a/stack.go b/stack.go index 4311b37..c534ff2 100644 --- a/stack.go +++ b/stack.go @@ -133,7 +133,11 @@ _=ymargin if current != nil { // connect first left to first right current.neighbor = c } - current = as[0] // next left is first subwidget + if len(as) != 0 { + current = as[0] // next left is first subwidget + } else { + current = nil // spaces don't have allocation data + } } allocations = append(allocations, as...) if s.orientation == horizontal {