From 199e3ef4ada7a49b400c5d613ad0522c6c8e427f Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sun, 14 Jan 2018 19:24:24 -0800 Subject: [PATCH] Core: Fix crash if cheat autosave fails --- src/core/cheats.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/cheats.c b/src/core/cheats.c index 30b802bca..d0ed72508 100644 --- a/src/core/cheats.c +++ b/src/core/cheats.c @@ -260,6 +260,9 @@ void mCheatAutosave(struct mCheatDevice* device) { return; } struct VFile* vf = mDirectorySetOpenSuffix(&device->p->dirs, device->p->dirs.cheats, ".cheats", O_WRONLY | O_CREAT | O_TRUNC); + if (!vf) { + return; + } mCheatSaveFile(device, vf); vf->close(vf); }