From b0f71eae483a42807aefc84c141138b350f6bcf8 Mon Sep 17 00:00:00 2001 From: pixel-stuck Date: Sun, 18 Nov 2018 17:08:20 -0500 Subject: [PATCH] Check IPC result and check isEnabled isn't NULL --- nx/source/services/pcv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nx/source/services/pcv.c b/nx/source/services/pcv.c index b4053eb0..b594dde6 100644 --- a/nx/source/services/pcv.c +++ b/nx/source/services/pcv.c @@ -159,7 +159,7 @@ Result pcvGetVoltageEnabled(bool *isEnabled, u32 voltage) { Result rc = serviceIpcDispatch(&g_pcvSrv); - if (R_SUCCEEDED(rc) && isEnabled) { + if (R_SUCCEEDED(rc)) { IpcParsedCommand r; struct { u64 magic; @@ -171,7 +171,9 @@ Result pcvGetVoltageEnabled(bool *isEnabled, u32 voltage) { resp = r.Raw; rc = resp->result; - *isEnabled = (bool)resp->isEnabled; + if(R_SUCCEEDED(rc) && isEnabled) { + *isEnabled = (bool)resp->isEnabled; + } } return rc;