From f98c4d18b14eeaa12d1de0940f58070d404fd1c9 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sat, 20 Jun 2020 19:58:41 -0400 Subject: [PATCH] dont create empty file when manually flushing null save ram --- src/BizHawk.Client.EmuHawk/MainForm.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index b039b2b8fc..57b81262e1 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -1754,14 +1754,12 @@ namespace BizHawk.Client.EmuHawk } } + var saveram = Emulator.AsSaveRam().CloneSaveRam(); + if (saveram == null) + return true; + using (var writer = new BinaryWriter(new FileStream(newPath, FileMode.Create, FileAccess.Write))) - { - var saveram = Emulator.AsSaveRam().CloneSaveRam(); - if (saveram != null) - { - writer.Write(saveram, 0, saveram.Length); - } - } + writer.Write(saveram, 0, saveram.Length); if (file.Exists) {