error if cheats cannot be read (#896)

This commit is contained in:
Logan McNaughton 2026-05-15 19:44:04 +02:00 committed by GitHub
parent 03be98b571
commit eda3dda613
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -155,11 +155,14 @@ pub async fn run() -> std::io::Result<()> {
let disable_expansion_pak = args
.disable_expansion_pak
.unwrap_or(device.ui.config.emulation.disable_expansion_pak);
let cheats = if let Some(cheats_file) = args.cheats
&& let Ok(data) = std::fs::read(cheats_file)
&& let Ok(cheats) = serde_json::from_slice(&data)
{
cheats
let cheats = if let Some(cheats_file) = args.cheats {
if let Ok(data) = std::fs::read(cheats_file)
&& let Ok(cheats) = serde_json::from_slice(&data)
{
cheats
} else {
return Err(Error::other("Could not read cheats file"));
}
} else {
let game_crc = ui::storage::get_game_crc(&rom_contents);
ui::config::Cheats::new()