Răsfoiți Sursa

core: Make sure npad is initialized

Narr the Reg 2 ani în urmă
părinte
comite
e8ad603cd9
2 a modificat fișierele cu 4 adăugiri și 1 ștergeri
  1. 3 0
      src/core/hid/input_interpreter.cpp
  2. 1 1
      src/core/memory/cheat_engine.cpp

+ 3 - 0
src/core/hid/input_interpreter.cpp

@@ -20,6 +20,9 @@ InputInterpreter::InputInterpreter(Core::System& system)
 InputInterpreter::~InputInterpreter() = default;
 InputInterpreter::~InputInterpreter() = default;
 
 
 void InputInterpreter::PollInput() {
 void InputInterpreter::PollInput() {
+    if (npad == nullptr) {
+        return;
+    }
     const auto button_state = npad->GetAndResetPressState();
     const auto button_state = npad->GetAndResetPressState();
 
 
     previous_index = current_index;
     previous_index = current_index;

+ 1 - 1
src/core/memory/cheat_engine.cpp

@@ -62,7 +62,7 @@ u64 StandardVmCallbacks::HidKeysDown() {
     }
     }
 
 
     const auto applet_resource = hid->GetResourceManager();
     const auto applet_resource = hid->GetResourceManager();
-    if (applet_resource == nullptr) {
+    if (applet_resource == nullptr || applet_resource->GetNpad() == nullptr) {
         LOG_WARNING(CheatEngine,
         LOG_WARNING(CheatEngine,
                     "Attempted to read input state, but applet resource is not initialized!");
                     "Attempted to read input state, but applet resource is not initialized!");
         return 0;
         return 0;