mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 06:34:19 +00:00
7->8 Handle garbage string trash
no terminator? no problem
This commit is contained in:
parent
da51291364
commit
f5c6510b82
1 changed files with 5 additions and 1 deletions
|
@ -171,7 +171,11 @@ public static class StringConverter8
|
|||
{
|
||||
// If a replacement is made, any leading or trailing halfwidth spaces are trimmed.
|
||||
// This allows nicknames/OT names that are the empty string or consist entirely of fullwidth spaces.
|
||||
var region = u16[..u16.IndexOf((char)TerminatorNull)];
|
||||
int length = u16.IndexOf((char)TerminatorNull);
|
||||
if (length == -1)
|
||||
length = u16.Length; // Full buffer (bad input), but still remap.
|
||||
|
||||
var region = u16[..length];
|
||||
char seek = ' ';
|
||||
if (BitConverter.IsLittleEndian)
|
||||
seek = (char)ReverseEndianness(' ');
|
||||
|
|
Loading…
Reference in a new issue