Skip to content

Commit f90fd9d

Browse files
committed
Fix nullptr reference error
1 parent f3838b7 commit f90fd9d

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

libretro/LibretroGraphicsContext.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,17 @@ class LibretroSoftwareContext : public LibretroGraphicsContext {
8989
LibretroSoftwareContext() {}
9090
bool Init() override { return true; }
9191
void SwapBuffers() override {
92-
GPUDebugBuffer buf;
93-
u16 w = NATIVEWIDTH;
94-
u16 h = NATIVEHEIGHT;
95-
gpuDebug->GetOutputFramebuffer(buf);
96-
const std::vector<u32> pixels = TranslateDebugBufferToCompare(&buf, w, h);
97-
memcpy(soft_bmp, pixels.data(), SOFT_BMP_SIZE);
98-
u32 offset = g_Config.bDisplayCropTo16x9 ? w << 1 : 0;
99-
h -= g_Config.bDisplayCropTo16x9 ? 2 : 0;
100-
video_cb(soft_bmp + offset, w, h, w << 2);
92+
if (gpuDebug != nullptr) {
93+
GPUDebugBuffer buf;
94+
u16 w = NATIVEWIDTH;
95+
u16 h = NATIVEHEIGHT;
96+
gpuDebug->GetOutputFramebuffer(buf);
97+
const std::vector<u32> pixels = TranslateDebugBufferToCompare(&buf, w, h);
98+
memcpy(soft_bmp, pixels.data(), SOFT_BMP_SIZE);
99+
u32 offset = g_Config.bDisplayCropTo16x9 ? w << 1 : 0;
100+
h -= g_Config.bDisplayCropTo16x9 ? 2 : 0;
101+
video_cb(soft_bmp + offset, w, h, w << 2);
102+
}
101103
}
102104
GPUCore GetGPUCore() override { return GPUCORE_SOFTWARE; }
103105
const char *Ident() override { return "Software"; }

0 commit comments

Comments
 (0)