From 2a368ef9947f8de0cfa623d798a3a9620ae4a9e4 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 12 May 2022 12:41:28 +0200 Subject: [PATCH] Add invalid mod warn --- src/config/ConfigManager.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index b208bac6..1083db44 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -284,6 +284,7 @@ void CConfigManager::handleBind(const std::string& command, const std::string& v auto valueCopy = value; const auto MOD = g_pKeybindManager->stringToModMask(valueCopy.substr(0, valueCopy.find_first_of(","))); + const auto MODSTR = valueCopy.substr(0, valueCopy.find_first_of(",")); valueCopy = valueCopy.substr(valueCopy.find_first_of(",") + 1); const auto KEY = valueCopy.substr(0, valueCopy.find_first_of(",")); @@ -302,6 +303,12 @@ void CConfigManager::handleBind(const std::string& command, const std::string& v return; } + if (MOD == 0 && MODSTR != "") { + Debug::log(ERR, "Invalid mod!"); + parseError = "Invalid mod, requested mod \"" + MODSTR + "\" is not a valid mod."; + return; + } + if (KEY != "") g_pKeybindManager->addKeybind(SKeybind{KEY, MOD, HANDLER, COMMAND}); }