Properly handle OOMExceptions when creating a 360° screenshot
This commit is contained in:
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user