Properly handle OOMExceptions when creating a 360° screenshot

This commit is contained in:
CrushedPixel
2017-10-31 17:28:21 +01:00
parent 98098ea2ed
commit 7d380e770a
2 changed files with 48 additions and 36 deletions

View File

@@ -6,6 +6,7 @@ import com.replaymod.extras.ReplayModExtras;
import com.replaymod.render.frame.RGBFrame;
import com.replaymod.render.rendering.FrameConsumer;
import com.replaymod.replay.ReplayModReplay;
import net.minecraft.client.Minecraft;
import net.minecraft.crash.CrashReport;
import org.lwjgl.util.ReadableDimension;
@@ -40,6 +41,10 @@ public class ScreenshotWriter implements FrameConsumer<RGBFrame> {
}
ImageIO.write(img, "PNG", outputFile);
} catch (OutOfMemoryError e) {
e.printStackTrace();
CrashReport report = CrashReport.makeCrashReport(e, "Exporting frame");
Minecraft.getMinecraft().crashed(report);
} catch (Throwable t) {
CrashReport report = CrashReport.makeCrashReport(t, "Exporting frame");