Init function can return an error.

This commit is contained in:
Sander Schobers 2019-05-01 09:40:59 +02:00
parent 7f9f10075f
commit 6a71720b71
2 changed files with 5 additions and 2 deletions

View File

@ -24,5 +24,5 @@ type Control interface {
type RootControl interface {
Control
Init(Context)
Init(Context) error
}

View File

@ -16,7 +16,10 @@ func RunWait(r Renderer, s *Style, view Control, wait bool) error {
ctx := &context{r: r, style: s, view: view, ims: NewImages(r)}
root, ok := view.(RootControl)
if ok {
root.Init(ctx)
err := root.Init(ctx)
if err != nil {
return err
}
}
anim := time.NewTicker(30 * time.Millisecond)
go func() {