ButtonComboAPI: Check if provided callback is null

This commit is contained in:
Maschell
2025-01-12 14:47:11 +01:00
parent 94ca12b415
commit c884b17695

View File

@@ -340,6 +340,11 @@ namespace {
class ButtonComboWrapper {
public:
static std::optional<ButtonComboWrapper> 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<ComboCallbackWrapperData>(otherOptions.callbackOptions.callback, otherOptions.callbackOptions.context);
ButtonComboModule_ComboOptions convertedOptions;