Debugger: Fixed crash when trying to use the "Edit selected code" on a block start/end header

This commit is contained in:
Sour 2025-02-05 17:36:24 +09:00
parent 797ef1f57a
commit a574032c8f
2 changed files with 8 additions and 2 deletions

View file

@ -97,7 +97,9 @@ namespace Mesen.Debugger.ViewModels
StartAddress = address;
Code = code;
_originalCode = DebugApi.GetMemoryValues(CpuType.ToMemoryType(), (uint)StartAddress, (uint)(StartAddress + OriginalByteCount - 1));
if(OriginalByteCount > 0) {
_originalCode = DebugApi.GetMemoryValues(CpuType.ToMemoryType(), (uint)StartAddress, (uint)(StartAddress + OriginalByteCount - 1));
}
}
private void UpdateAssembly(string code)

View file

@ -393,7 +393,11 @@ namespace Mesen.Debugger.ViewModels
}
} while(i < SelectionEnd);
byteCount = endAddress - SelectionStart + 1;
if(SelectionStart <= endAddress) {
byteCount = endAddress - SelectionStart + 1;
} else {
byteCount = 0;
}
return sb.ToString();
}