Boxes no longer panic on nil texture
This commit is contained in:
parent
af6aa2c463
commit
0c0b8ae475
@ -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 {
|
||||
|
Reference in New Issue
Block a user