Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

hid_core: Prevent crash if we try to iterate through empty color devices list

t89595ea8e955324
diff --git a/src/hid_core/frontend/emulated_controller.cpp b/src/hid_core/frontend/emulated_controller.cpp
index b4b6fa7c8d..8b5d0eec6e 100644
--- a/src/hid_core/frontend/emulated_controller.cpp
+++ b/src/hid_core/frontend/emulated_controller.cpp
@@ -581,6 +581,9 @@ void EmulatedController::DisableConfiguration() {
// Get Joycon colors before turning on the controller
for (const auto& color_device : color_devices) {
+ if (color_device == nullptr) {
+ continue;
+ }
color_device->ForceUpdate();
}