mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 12:33:06 +00:00
BDSP: Handle uninitialized box names
span refactoring didn't catch this also apply same change for gen4 battle revolution string reads
This commit is contained in:
parent
bb2b8e74c3
commit
574a7f43a0
2 changed files with 4 additions and 4 deletions
|
@ -205,7 +205,7 @@ namespace PKHeX.Core
|
|||
|
||||
int ofs = BoxName + (box * BoxNameLength);
|
||||
var span = Data.AsSpan(ofs, BoxNameLength);
|
||||
if (span.Count((byte)0) == span.Length)
|
||||
if (ReadUInt16BigEndian(span) == 0)
|
||||
return $"BOX {box + 1}";
|
||||
return GetString(ofs, BoxNameLength);
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ namespace PKHeX.Core
|
|||
|
||||
int ofs = BoxName + (box * BoxNameLength);
|
||||
var span = Data.AsSpan(ofs, BoxNameLength);
|
||||
if (span.Count((byte)0) == span.Length)
|
||||
if (ReadUInt16BigEndian(span) == 0)
|
||||
return;
|
||||
|
||||
SetString(span, value.AsSpan(), BoxNameLength / 2, StringConverterOption.ClearZero);
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace PKHeX.Core
|
|||
public string GetBoxName(int box)
|
||||
{
|
||||
var span = Data.AsSpan(Offset + GetBoxNameOffset(box), SAV6.LongStringLength);
|
||||
if (span.Count((byte)0) == span.Length)
|
||||
if (ReadUInt16LittleEndian(span) == 0)
|
||||
return $"Box {box + 1}";
|
||||
return SAV.GetString(span);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
var offset = Offset + GetTeamNameOffset(team);
|
||||
var span = Data.AsSpan(offset, TeamNameLength);
|
||||
if (span.Count((byte)0) == span.Length)
|
||||
if (ReadUInt16LittleEndian(span) == 0)
|
||||
return $"Team {team + 1}";
|
||||
return SAV.GetString(span);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue