Skip to content

Commit

Permalink
Fix an emulator crash in Emulator::SaveSettings (#13567)
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 committed Mar 21, 2023
1 parent 7000ef4 commit 7e6cc02
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions rpcs3/Emu/System.cpp
Expand Up @@ -3356,10 +3356,17 @@ void Emulator::SaveSettings(const std::string& settings, const std::string& titl

// Save config atomically
fs::pending_file temp(config_name);
temp.file.write(settings.c_str(), settings.size());
if (!temp.commit())
if (!temp.file)
{
sys_log.error("Could not save config to %s (error=%s)", config_name, fs::g_tls_error);
sys_log.error("Could not save config to %s (failed to create temporary file) (error=%s)", config_name, fs::g_tls_error);
}
else
{
temp.file.write(settings.c_str(), settings.size());
if (!temp.commit())
{
sys_log.error("Could not save config to %s (failed to commit) (error=%s)", config_name, fs::g_tls_error);
}
}

// Check if the running config/title is the same as the edited config/title.
Expand Down

0 comments on commit 7e6cc02

Please sign in to comment.