COMMON: punycode: move npos guard up

b0d722473b49e27417258f03ee802372f3ee354e introduced code that used
ni before this guard that ensures it has a proper value for strings
that contain no ASCII component.
This commit is contained in:
Misty De Meo 2023-06-07 14:53:44 -07:00
parent fb5982eacb
commit 90c4b57e9a
No known key found for this signature in database
GPG Key ID: 76CF846A2F674B2C

View File

@ -239,6 +239,10 @@ U32String punycode_decode(const String &src1) {
size_t di = src.findLastOf('-');
// If we have no '-', the entire string is non-ASCII character insertions.
if (di == String::npos)
di = 0;
Common::String tail;
// Sometimes strings could contain garbage at the end, like '.zip' added
@ -287,10 +291,6 @@ U32String punycode_decode(const String &src1) {
}
}
// If we have no '-', the entire string is non-ASCII character insertions.
if (di == String::npos)
di = 0;
U32String dst;
for (size_t i = 0; i < di; i++) {