From a947a45d8135bd0b6b1039904f48d92c0d455f3d Mon Sep 17 00:00:00 2001
From: TSRBerry <20988865+TSRBerry@users.noreply.github.com>
Date: Mon, 10 Apr 2023 17:00:23 +0200
Subject: [PATCH] gtk: Fix a NRE when disposing OpenGL (#4648)

---
 Ryujinx/Ui/GLRenderer.cs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Ryujinx/Ui/GLRenderer.cs b/Ryujinx/Ui/GLRenderer.cs
index 5804ed18..e3a9804e 100644
--- a/Ryujinx/Ui/GLRenderer.cs
+++ b/Ryujinx/Ui/GLRenderer.cs
@@ -119,7 +119,7 @@ namespace Ryujinx.Ui
             }
             catch (Exception) { }
 
-            Device.DisposeGpu();
+            Device?.DisposeGpu();
             NpadManager.Dispose();
 
             // Unbind context and destroy everything
@@ -129,7 +129,7 @@ namespace Ryujinx.Ui
             }
             catch (Exception) { }
 
-            _openGLContext.Dispose();
+            _openGLContext?.Dispose();
         }
     }
 }