Boxes no longer panic on nil texture

This commit is contained in:
Sasha Koshka 2023-09-05 21:23:24 -04:00
parent af6aa2c463
commit 0c0b8ae475

View File

@ -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 {