mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 04:38:49 +00:00
Config: Handle unknown system strings better
Currently, a simple typo in the system name will trigger an assert message that complains about a "programming error". This is not user friendly and misleading. So this changes GetSystemFromName to return an std::optional, which allows for callers to check whether the system exists and handle failures better.
This commit is contained in:
parent
653977cec7
commit
05c8d229af
4 changed files with 14 additions and 8 deletions
|
@ -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&);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue