mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 19:28:57 +01:00
restorable: Ensure the given image is not nil at makeStaleIfDependingOn
This commit is contained in:
parent
b15fb523a8
commit
1616373819
@ -105,13 +105,11 @@ func (i *images) resolveStaleImages() error {
|
||||
// When target is changed, all images depending on target can't be restored with target.
|
||||
// makeStaleIfDependingOn is called in such situation.
|
||||
func (i *images) makeStaleIfDependingOn(target *Image) {
|
||||
if target == nil {
|
||||
panic("not reached")
|
||||
}
|
||||
// Avoid defer for performance
|
||||
i.m.Lock()
|
||||
if target == nil {
|
||||
// disposed
|
||||
i.m.Unlock()
|
||||
return
|
||||
}
|
||||
if i.lastTarget == target {
|
||||
i.m.Unlock()
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user