Fix crashing bug in Goto

The application would crash if an invalid file offset was entered
(with "+xxxx").  This bug has been present since v1.0.
This commit is contained in:
Andy McFadden committed 2020-01-24 15:25:01 -08:00
1 parent d4b97007df
commit 6ff349c2f6
1 file changed
+4 -1
+4 -1
View File
@@ -136,7 +136,10 @@ namespace SourceGen.WpfGui {
if (input[0] == '+') {
// this can only be an offset; convert as hexadecimal number
try {
TargetOffset = Convert.ToInt32(input.Substring(1), 16);
int offset = Convert.ToInt32(input.Substring(1), 16);
if (offset >= 0 && offset < mProject.FileDataLength) {
TargetOffset = offset;
}
} catch (Exception) {
}
return;