Return null for invalid resources rather than the missing texture (avoids de-allocating the missing texture's image)

This commit is contained in:
Sollace 2019-07-14 01:27:38 +02:00
parent 310e713d71
commit 857e06198a

View file

@ -92,9 +92,10 @@ public class Pony implements IPony {
return null; return null;
} }
@Nullable
private static NativeImage getBufferedImage(@Nullable Identifier resource) { private static NativeImage getBufferedImage(@Nullable Identifier resource) {
if (resource == null) { if (resource == null) {
return MissingSprite.getMissingSpriteTexture().getImage(); return null;
} }
MinecraftClient mc = MinecraftClient.getInstance(); MinecraftClient mc = MinecraftClient.getInstance();
@ -126,7 +127,7 @@ public class Pony implements IPony {
// or buffer contained no/invalid image // or buffer contained no/invalid image
MineLittlePony.logger.fatal("Could not load texture from GL memory", e); MineLittlePony.logger.fatal("Could not load texture from GL memory", e);
return MissingSprite.getMissingSpriteTexture().getImage(); return null;
} }
return image; return image;
} }