From 857e06198a74971975c9ddc5d5186ee1613e276a Mon Sep 17 00:00:00 2001 From: Sollace Date: Sun, 14 Jul 2019 01:27:38 +0200 Subject: [PATCH] Return null for invalid resources rather than the missing texture (avoids de-allocating the missing texture's image) --- src/main/java/com/minelittlepony/client/pony/Pony.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/minelittlepony/client/pony/Pony.java b/src/main/java/com/minelittlepony/client/pony/Pony.java index bc480d87..6f033f42 100644 --- a/src/main/java/com/minelittlepony/client/pony/Pony.java +++ b/src/main/java/com/minelittlepony/client/pony/Pony.java @@ -92,9 +92,10 @@ public class Pony implements IPony { return null; } + @Nullable private static NativeImage getBufferedImage(@Nullable Identifier resource) { if (resource == null) { - return MissingSprite.getMissingSpriteTexture().getImage(); + return null; } MinecraftClient mc = MinecraftClient.getInstance(); @@ -126,7 +127,7 @@ public class Pony implements IPony { // or buffer contained no/invalid image MineLittlePony.logger.fatal("Could not load texture from GL memory", e); - return MissingSprite.getMissingSpriteTexture().getImage(); + return null; } return image; }