From 8421863c780a370f6c5cb3bfe553393e90f862da Mon Sep 17 00:00:00 2001 From: fincs Date: Tue, 10 Mar 2020 17:42:00 +0100 Subject: [PATCH] applet: appletSetFocusHandlingMode should only be used with Application --- nx/include/switch/services/applet.h | 4 ++++ nx/source/services/applet.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/nx/include/switch/services/applet.h b/nx/include/switch/services/applet.h index ee02c6f0..2fc56b32 100644 --- a/nx/include/switch/services/applet.h +++ b/nx/include/switch/services/applet.h @@ -2468,6 +2468,10 @@ AppletOperationMode appletGetOperationMode(void); ApmPerformanceMode appletGetPerformanceMode(void); AppletFocusState appletGetFocusState(void); +/** + * @brief Sets the current \ref AppletFocusHandlingMode. + * @note Should only be called with AppletType_Application. + */ Result appletSetFocusHandlingMode(AppletFocusHandlingMode mode); ///@} diff --git a/nx/source/services/applet.c b/nx/source/services/applet.c index e66ac5ba..f83ed9f0 100644 --- a/nx/source/services/applet.c +++ b/nx/source/services/applet.c @@ -541,6 +541,8 @@ Result appletSetFocusHandlingMode(AppletFocusHandlingMode mode) { Result rc; bool invals[4]; + if (__nx_applet_type != AppletType_Application) + return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); if (mode >= AppletFocusHandlingMode_Max) return MAKERESULT(Module_Libnx, LibnxError_BadInput);