aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorNarr the Reg <juangerman-13@hotmail.com>2023-12-14 20:04:38 -0600
committerNarr the Reg <juangerman-13@hotmail.com>2023-12-14 20:04:38 -0600
commitfd0ac567a50cf7cfa731ef1c8fb6531d56f73b01 (patch)
treec56b5098483f619bc95f67b0acaf1daf4189ccb5 /src/core
parent5913b7a75088de67cb7d1e461e20b0e94bb4a117 (diff)
core: Make sure npad is initialized
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hid/input_interpreter.cpp3
-rw-r--r--src/core/memory/cheat_engine.cpp2
2 files changed, 4 insertions, 1 deletions
diff --git a/src/core/hid/input_interpreter.cpp b/src/core/hid/input_interpreter.cpp
index a6bdd28f2a..072f38a68e 100644
--- a/src/core/hid/input_interpreter.cpp
+++ b/src/core/hid/input_interpreter.cpp
@@ -20,6 +20,9 @@ InputInterpreter::InputInterpreter(Core::System& system)
InputInterpreter::~InputInterpreter() = default;
void InputInterpreter::PollInput() {
+ if (npad == nullptr) {
+ return;
+ }
const auto button_state = npad->GetAndResetPressState();
previous_index = current_index;
diff --git a/src/core/memory/cheat_engine.cpp b/src/core/memory/cheat_engine.cpp
index db30ba598c..3fc4024dc7 100644
--- a/src/core/memory/cheat_engine.cpp
+++ b/src/core/memory/cheat_engine.cpp
@@ -62,7 +62,7 @@ u64 StandardVmCallbacks::HidKeysDown() {
}
const auto applet_resource = hid->GetResourceManager();
- if (applet_resource == nullptr) {
+ if (applet_resource == nullptr || applet_resource->GetNpad() == nullptr) {
LOG_WARNING(CheatEngine,
"Attempted to read input state, but applet resource is not initialized!");
return 0;