summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-04-29 10:00:27 -0400
committerPietro Gagliardi <[email protected]>2014-04-29 10:00:27 -0400
commitf8bca7e0e059a5c1612b29e9b3a44519ab6608d5 (patch)
treebd2297a9d93b8e33ff74e0ae047ef1f1fc25db65
parentc993c6b8e8ce63a098d56f88b22060b1ea5a9373 (diff)
Added a sanity check for stretchy control indices in the Grid code.
-rw-r--r--grid.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/grid.go b/grid.go
index c38ecf4..51cec37 100644
--- a/grid.go
+++ b/grid.go
@@ -159,8 +159,10 @@ func (g *Grid) setRect(x int, y int, width int, height int, rr *[]resizerequest)
}
g.colwidths[g.stretchycol] = width
g.rowheights[g.stretchyrow] = height
+ } else if (g.stretchyrow == -1 && g.stretchycol != -1) || // sanity check
+ (g.stretchyrow != -1 && g.stretchycol == -1) {
+ panic(fmt.Errorf("internal inconsistency in Grid: stretchy (%d,%d) impossible (one component, not both, is -1/no stretchy control)", g.stretchyrow, g.stretchycol))
}
- // TODO add a sanity check for g.stretchyrow xor g.stretchycol == -1?
// 4) draw
startx := x
for row, xcol := range g.controls {