Skip to content

Commit

Permalink
Don't panic - get the size by rendering the child
Browse files Browse the repository at this point in the history
  • Loading branch information
gcla committed Jul 27, 2020
1 parent 66c7cdc commit 91c9533
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions widgets/withscrollbar/withscrollbar.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,11 @@ func (w *Widget) Render(size gowid.IRenderSize, focus gowid.Selector, app gowid.
return w.w.Render(size, focus, app)
}

box, ok := size.(gowid.IRenderBox)
var box gowid.IRenderBox
var ok bool
box, ok = size.(gowid.IRenderBox)
if !ok {
panic(gowid.WidgetSizeError{Widget: w, Size: size, Required: "gowid.IRenderBox"})
box = w.always.Render(size, focus, app)
}
ecols := box.BoxColumns() - 1
var x int
Expand Down

0 comments on commit 91c9533

Please sign in to comment.