From 0c0b8ae475e80c9e0c458962c04ea0eb764067a0 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Tue, 5 Sep 2023 21:23:24 -0400 Subject: [PATCH] Boxes no longer panic on nil texture --- canvas/texture.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/canvas/texture.go b/canvas/texture.go index d529379..da1b900 100644 --- a/canvas/texture.go +++ b/canvas/texture.go @@ -95,6 +95,9 @@ func (this *Texture) Clip (bounds image.Rectangle) canvas.Texture { // AssertTexture checks if a given canvas.Texture is a texture from this package. func AssertTexture (unknown canvas.Texture) *Texture { + if unknown == nil { + return nil + } if tx, ok := unknown.(*Texture); ok { return tx } else {