mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-27 11:12:44 +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.
|
// When target is changed, all images depending on target can't be restored with target.
|
||||||
// makeStaleIfDependingOn is called in such situation.
|
// makeStaleIfDependingOn is called in such situation.
|
||||||
func (i *images) makeStaleIfDependingOn(target *Image) {
|
func (i *images) makeStaleIfDependingOn(target *Image) {
|
||||||
|
if target == nil {
|
||||||
|
panic("not reached")
|
||||||
|
}
|
||||||
// Avoid defer for performance
|
// Avoid defer for performance
|
||||||
i.m.Lock()
|
i.m.Lock()
|
||||||
if target == nil {
|
|
||||||
// disposed
|
|
||||||
i.m.Unlock()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if i.lastTarget == target {
|
if i.lastTarget == target {
|
||||||
i.m.Unlock()
|
i.m.Unlock()
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user