From 5cc8d8476bd385771f8f9826aa2c59fb12e00fff Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 18 Apr 2021 23:02:29 +0900 Subject: [PATCH] ebiten: Bug fix: Ignore the outside size when they are 0 at Layout Closes #1589 --- uicontext.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/uicontext.go b/uicontext.go index b37351043..388a6479c 100644 --- a/uicontext.go +++ b/uicontext.go @@ -56,6 +56,11 @@ func (c *uiContext) setError(err error) { } func (c *uiContext) Layout(outsideWidth, outsideHeight float64) { + // The given outside size can be 0 e.g. just after restoring from the fullscreen mode on Windows (#1589) + // Just ignore such cases. Otherwise, creating a zero-sized framebuffer causes a panic. + if outsideWidth == 0 || outsideHeight == 0 { + return + } c.outsideSizeUpdated = true c.outsideWidth = outsideWidth c.outsideHeight = outsideHeight