From 173f284081fbce543537413c9d16398bd12f1a09 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 12 Jan 2025 14:47:11 +0100 Subject: [PATCH] ButtonComboAPI: Check if provided callback is null --- source/plugin/ButtonComboManager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/plugin/ButtonComboManager.cpp b/source/plugin/ButtonComboManager.cpp index 3d1c64c..7385b7c 100644 --- a/source/plugin/ButtonComboManager.cpp +++ b/source/plugin/ButtonComboManager.cpp @@ -340,6 +340,11 @@ namespace { class ButtonComboWrapper { public: static std::optional Create(const WUPSButtonCombo_ComboOptions &otherOptions, WUPSButtonCombo_ComboStatus &outStatus, WUPSButtonCombo_Error &outError) { + if (otherOptions.callbackOptions.callback == nullptr) { + outStatus = WUPS_BUTTON_COMBO_COMBO_STATUS_INVALID_STATUS; + outError = WUPS_BUTTON_COMBO_ERROR_INVALID_ARGS; + return {}; + } ButtonComboModule_ComboStatus status = BUTTON_COMBO_MODULE_COMBO_STATUS_INVALID_STATUS; auto contextData = std::make_unique(otherOptions.callbackOptions.callback, otherOptions.callbackOptions.context); ButtonComboModule_ComboOptions convertedOptions;