diff options
| author | Pierre Bourdon <delroth@gmail.com> | 2017-12-07 15:16:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-07 15:16:39 +0100 |
| commit | 8a830074b64e0487afa523cd465de5ab40efb0a7 (patch) | |
| tree | 2c51deeb7f21c84b4ffb6e2e0394fe0d103ac4ae /Source/Core/Common/Config | |
| parent | ecf30cfc749ff49697c8b6bf24efae4202a2bf61 (diff) | |
| parent | 05c8d229afc3d88f4c368a648e96b049ccd2fba3 (diff) | |
Merge pull request #6220 from leoetlino/utf8
WX: Fix argument parsing
Diffstat (limited to 'Source/Core/Common/Config')
| -rw-r--r-- | Source/Core/Common/Config/Config.cpp | 5 | ||||
| -rw-r--r-- | Source/Core/Common/Config/Config.h | 3 |
2 files changed, 4 insertions, 4 deletions
diff --git a/Source/Core/Common/Config/Config.cpp b/Source/Core/Common/Config/Config.cpp index a3504f80d2..342ef8ec6d 100644 --- a/Source/Core/Common/Config/Config.cpp +++ b/Source/Core/Common/Config/Config.cpp @@ -101,15 +101,14 @@ const std::string& GetSystemName(System system) return system_to_name.at(system); } -System GetSystemFromName(const std::string& name) +std::optional<System> GetSystemFromName(const std::string& name) { const auto system = std::find_if(system_to_name.begin(), system_to_name.end(), [&name](const auto& entry) { return entry.second == name; }); if (system != system_to_name.end()) return system->first; - _assert_msg_(COMMON, false, "Programming error! Couldn't convert '%s' to system!", name.c_str()); - return System::Main; + return {}; } const std::string& GetLayerName(LayerType layer) diff --git a/Source/Core/Common/Config/Config.h b/Source/Core/Common/Config/Config.h index 3536f5677c..14a2dcb20c 100644 --- a/Source/Core/Common/Config/Config.h +++ b/Source/Core/Common/Config/Config.h @@ -7,6 +7,7 @@ #include <functional> #include <map> #include <memory> +#include <optional> #include <string> #include "Common/Config/ConfigInfo.h" @@ -38,7 +39,7 @@ void Shutdown(); void ClearCurrentRunLayer(); const std::string& GetSystemName(System system); -System GetSystemFromName(const std::string& system); +std::optional<System> GetSystemFromName(const std::string& system); const std::string& GetLayerName(LayerType layer); LayerType GetActiveLayerForConfig(const ConfigLocation&); |
