diff options
| author | 2023-11-23 00:30:49 -0500 | |
|---|---|---|
| committer | 2023-11-23 00:30:49 -0500 | |
| commit | 0b8218d8ebc07a17d94505068498014e9f61f6c9 (patch) | |
| tree | 37f8a708f67317260044fd7b38b79ba6031f6cc9 /src/frontend_common/config.cpp | |
| parent | frontend_common: Add option to read unsigned integers (diff) | |
| download | yuzu-0b8218d8ebc07a17d94505068498014e9f61f6c9.tar.gz yuzu-0b8218d8ebc07a17d94505068498014e9f61f6c9.tar.xz yuzu-0b8218d8ebc07a17d94505068498014e9f61f6c9.zip | |
frontend_common: Don't load config files that we fail to open
Diffstat (limited to 'src/frontend_common/config.cpp')
| -rw-r--r-- | src/frontend_common/config.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/frontend_common/config.cpp b/src/frontend_common/config.cpp index a68a9cb4b..eae4fdc8e 100644 --- a/src/frontend_common/config.cpp +++ b/src/frontend_common/config.cpp | |||
| @@ -65,6 +65,11 @@ void Config::WriteToIni() const { | |||
| 65 | fp = fopen(config_loc.c_str(), "wb"); | 65 | fp = fopen(config_loc.c_str(), "wb"); |
| 66 | #endif | 66 | #endif |
| 67 | 67 | ||
| 68 | if (fp == nullptr) { | ||
| 69 | LOG_ERROR(Frontend, "Config file could not be saved!"); | ||
| 70 | return; | ||
| 71 | } | ||
| 72 | |||
| 68 | CSimpleIniA::FileWriter writer(fp); | 73 | CSimpleIniA::FileWriter writer(fp); |
| 69 | const SI_Error rc = config->Save(writer, false); | 74 | const SI_Error rc = config->Save(writer, false); |
| 70 | if (rc < 0) { | 75 | if (rc < 0) { |
| @@ -91,6 +96,11 @@ void Config::SetUpIni() { | |||
| 91 | } | 96 | } |
| 92 | #endif | 97 | #endif |
| 93 | 98 | ||
| 99 | if (fp == nullptr) { | ||
| 100 | LOG_ERROR(Frontend, "Config file could not be loaded!"); | ||
| 101 | return; | ||
| 102 | } | ||
| 103 | |||
| 94 | if (SI_Error rc = config->LoadFile(fp); rc < 0) { | 104 | if (SI_Error rc = config->LoadFile(fp); rc < 0) { |
| 95 | LOG_ERROR(Frontend, "Config file could not be loaded!"); | 105 | LOG_ERROR(Frontend, "Config file could not be loaded!"); |
| 96 | } | 106 | } |