From 444b25bae125bf318f08774aa1c335dedd502e6a Mon Sep 17 00:00:00 2001
From: Liam <byteslice@airmail.cc>
Date: Fri, 6 Jan 2023 21:23:21 -0500
Subject: [PATCH] vulkan_device: avoid attempt to access empty optional

---
 src/video_core/vulkan_common/vulkan_device.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp
index 77aee802de..07c984c5e8 100644
--- a/src/video_core/vulkan_common/vulkan_device.cpp
+++ b/src/video_core/vulkan_common/vulkan_device.cpp
@@ -1520,8 +1520,12 @@ void Device::SetupFamilies(VkSurfaceKHR surface) {
         LOG_ERROR(Render_Vulkan, "Device lacks a present queue");
         throw vk::Exception(VK_ERROR_FEATURE_NOT_PRESENT);
     }
-    graphics_family = *graphics;
-    present_family = *present;
+    if (graphics) {
+        graphics_family = *graphics;
+    }
+    if (present) {
+        present_family = *present;
+    }
 }
 
 void Device::SetupFeatures() {