Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix an emulator crash in Emulator::SaveSettings #13567

Merged
merged 3 commits into from
Mar 21, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions rpcs3/Emu/System.cpp
Original file line number Diff line number Diff line change
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 temporay 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