ebiten: Bug fix: ForceUpdate could be called before initialization

Closes #1591
This commit is contained in:
Hajime Hoshi 2021-04-19 00:35:14 +09:00
parent 2f451e6014
commit 73f90f324f

View File

@ -160,6 +160,11 @@ func (c *uiContext) Update() error {
} }
func (c *uiContext) ForceUpdate() error { func (c *uiContext) ForceUpdate() error {
// ForceUpdate can be invoked even if uiContext it not initialized yet (#1591).
if c.outsideWidth == 0 || c.outsideHeight == 0 {
return nil
}
if err, ok := c.err.Load().(error); ok && err != nil { if err, ok := c.err.Load().(error); ok && err != nil {
return err return err
} }