Преглед изворни кода

core: hid: emulated_console: Avoid a crash if frontend does not configure touch_from_button_maps.

bunnei пре 3 година
родитељ
комит
05c709bebe
1 измењених фајлова са 5 додато и 0 уклоњено
  1. 5 0
      src/core/hid/emulated_console.cpp

+ 5 - 0
src/core/hid/emulated_console.cpp

@@ -40,6 +40,11 @@ void EmulatedConsole::SetTouchParams() {
         touch_params[index++] = std::move(touchscreen_param);
     }
 
+    if (Settings::values.touch_from_button_maps.empty()) {
+        LOG_WARNING(Input, "touch_from_button_maps is unset by frontend config");
+        return;
+    }
+
     const auto button_index =
         static_cast<u64>(Settings::values.touch_from_button_map_index.GetValue());
     const auto& touch_buttons = Settings::values.touch_from_button_maps[button_index].buttons;