From 1efc91cb945e1cfdfa65812d2ddc52d8b7da49d1 Mon Sep 17 00:00:00 2001 From: zeromus Date: Thu, 18 Jun 2020 03:07:44 -0400 Subject: [PATCH] hex editor: handle tiny (even 0 size) memory domains without crashing --- src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs b/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs index 88617a1dc9..90bd2cc832 100644 --- a/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs +++ b/src/BizHawk.Client.EmuHawk/tools/HexEditor/HexEditor.cs @@ -554,10 +554,13 @@ namespace BizHawk.Client.EmuHawk end = Math.Min(end, _domain.Size); end &= -(long)dataSize; - var range = new MutableRange(start, end - 1); - var dict = new Dictionary(); + if (end <= start) + return dict; + + var range = new MutableRange(start, end - 1); + switch (dataSize) { default: