From 6de19645f8fdd309cdf9f53d846b70f45ed66e62 Mon Sep 17 00:00:00 2001
From: Arisotura <thetotalworm@gmail.com>
Date: Sun, 2 Jun 2019 14:57:59 +0200
Subject: fix potential crash when running the software renderer (oops)

---
 src/GPU2D.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'src')

diff --git a/src/GPU2D.cpp b/src/GPU2D.cpp
index 212372c..c51b252 100644
--- a/src/GPU2D.cpp
+++ b/src/GPU2D.cpp
@@ -882,10 +882,12 @@ void GPU2D::VBlankEnd()
     OBJMosaicY = 0;
     OBJMosaicYMax = OBJMosaicSize[1];
 
-    // TODO: make optional
-    if ((Num == 0) && (CaptureCnt & (1<<31)) && (((CaptureCnt >> 29) & 0x3) != 1))
+    if (GPU3D::Renderer != 0)
     {
-        GPU3D::GLRenderer::PrepareCaptureFrame();
+        if ((Num == 0) && (CaptureCnt & (1<<31)) && (((CaptureCnt >> 29) & 0x3) != 1))
+        {
+            GPU3D::GLRenderer::PrepareCaptureFrame();
+        }
     }
 }
 
-- 
cgit v1.2.3