Box doesn't crash when cetering a nil texture

This commit is contained in:
Sasha Koshka 2024-05-27 15:20:11 -04:00
parent 09cec81f30
commit e38cbe7205

2
box.go
View File

@ -326,7 +326,7 @@ func (this *box) Draw (can canvas.Canvas) {
pen.Rectangle(bounds)
// centered texture
if this.textureMode == textureModeCenter {
if this.textureMode == textureModeCenter && this.texture != nil {
textureBounds := this.texture.Bounds()
textureOrigin :=
bounds.Min.