From 82706ef82d83b6d9c62f9398bfb3eae8b4bd95dd Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Wed, 6 Nov 2013 07:49:32 -0800 Subject: [PATCH] Fix a crash if the gpu doesn't load. E.g. for invalid files with multithreading enabled. --- Core/System.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Core/System.cpp b/Core/System.cpp index 1adf7089ec..34d9d80b81 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -260,8 +260,10 @@ void CPU_RunLoop() { } // Let's make sure the gpu has already cleaned up before we start freeing memory. - gpu->FinishEventLoop(); - gpu->SyncThread(true); + if (gpu) { + gpu->FinishEventLoop(); + gpu->SyncThread(true); + } CPU_Shutdown(); CPU_SetState(CPU_THREAD_NOT_RUNNING);