Default to 0 if relative offset is 0

fixes bad move type values
This commit is contained in:
Kurt
2020-06-03 21:22:36 -07:00
parent 70e2ba0a56
commit 9a276bc94e

View File

@@ -160,6 +160,8 @@ byte ReadU8(int v, int o)
if (vptr > vLength)
return default;
var rofs = BitConverter.ToUInt16(data, vptr);
if (rofs == 0)
return default;
return data[root + rofs];
}
@@ -169,6 +171,8 @@ ushort ReadU16(int v, int o)
if (vptr > vLength)
return default;
var rofs = BitConverter.ToUInt16(data, vptr);
if (rofs == 0)
return default;
return BitConverter.ToUInt16(data, root + rofs);
}
@@ -178,6 +182,8 @@ bool ReadB8(int v, int o)
if (vptr > vLength)
return default;
var rofs = BitConverter.ToUInt16(data, vptr);
if (rofs == 0)
return default;
return data[root + rofs] == 1;
}
}