From 540c52c13a921ebcb3c69fdf7c8d98213aafa0b6 Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Mon, 17 Apr 2023 15:12:07 +0200 Subject: [PATCH] small optimisation --- source/funkin/assets/Paths.hx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/funkin/assets/Paths.hx b/source/funkin/assets/Paths.hx index 7fcb2d31..b4552a29 100644 --- a/source/funkin/assets/Paths.hx +++ b/source/funkin/assets/Paths.hx @@ -172,11 +172,12 @@ class Paths * @param library (Additional) library to load the frames from. */ public static function getFrames(key:String, assetsPath:Bool = false, ?library:String) { - if (tempFramesCache[key] != null) { - if (tempFramesCache[key].parent != null && tempFramesCache[key].parent.bitmap != null && tempFramesCache[key].parent.bitmap.readable) - return tempFramesCache[key]; + if (tempFramesCache.exists(key)) { + var frames = tempFramesCache[key]; + if (frames.parent != null && frames.parent.bitmap != null && frames.parent.bitmap.readable) + return frames; else - tempFramesCache[key] = null; + tempFramesCache.remove(key); } return tempFramesCache[key] = loadFrames(assetsPath ? key : Paths.image(key, library, true)); }