From 9d481d90a0134eeb46676427c923c1d5eefc96e3 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sun, 14 Jul 2019 01:07:16 +0200 Subject: [PATCH] Also catch the original exception --- .../java/com/minelittlepony/client/pony/Pony.java | 11 +++++++++-- 1 file changed, 9 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 933fc317..54397646 100644 --- a/src/main/java/com/minelittlepony/client/pony/Pony.java +++ b/src/main/java/com/minelittlepony/client/pony/Pony.java @@ -115,7 +115,6 @@ public class Pony implements IPony { } catch (ExecutionException e) { MineLittlePony.logger.fatal("Error fetching native image from gl buffer", e); } - } return MissingSprite.getMissingSpriteTexture().getImage(); @@ -144,7 +143,15 @@ public class Pony implements IPony { // This allocates a new array to store the image every time. // Don't do this every time. Keep a cache and store it so we don't destroy memory. - image.loadFromTextureImage(0, false); + try { + image.loadFromTextureImage(0, false); + } catch (IllegalStateException e) { + // Out of memory + // or buffer contained no/invalid image + MineLittlePony.logger.fatal("Could not load texture from GL memory", e); + + return MissingSprite.getMissingSpriteTexture().getImage(); + } return image; }