Skip to content

Commit

Permalink
sdlmain: avoid crashing if no config files
Browse files Browse the repository at this point in the history
In some setups, even after trying to create a user-level
configuration, control->configfiles can end up empty. Other accesses
are protected, but the log message isn't; this moves it into the next
protected block to avoid crashing if configfiles is empty.

Signed-off-by: Stephen Kitt <[email protected]>
  • Loading branch information
skitt committed Dec 31, 2024
1 parent ba932f5 commit 90c825c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/gui/sdlmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8259,9 +8259,9 @@ int main(int argc, char* argv[]) SDL_MAIN_NOEXCEPT {
control->ParseConfigFile(config_combined.c_str()); // Load the conf file created above
if(control->configfiles.size()) LOG_MSG("CONFIG: Created and loaded user config file %s", config_combined.c_str());
}
LOG_MSG("CONFIG: Loaded config file: %s", control->configfiles.front().c_str());

if (control->configfiles.size()) {
LOG_MSG("CONFIG: Loaded config file: %s", control->configfiles.front().c_str());
if (control->opt_eraseconf&&control->config_file_list.empty()) {
LOG_MSG("Erase config file: %s\n", control->configfiles.front().c_str());
unlink(control->configfiles.front().c_str());
Expand Down

0 comments on commit 90c825c

Please sign in to comment.