Core/PacketIO: Reduce the number of catch blocks in WorldSession::Update

This commit is contained in:
Shauren
2025-11-02 17:19:01 +01:00
parent 9d1bdda6d8
commit 57489f4ca9
5 changed files with 56 additions and 42 deletions

View File

@@ -65,7 +65,7 @@ std::string_view ByteBuffer::ReadCString(bool requireValidUtf8 /*= true*/)
std::string_view value(begin, stringEnd);
_rpos += value.length() + 1;
if (requireValidUtf8 && !utf8::is_valid(value.begin(), value.end()))
throw ByteBufferInvalidValueException("string", value);
throw ByteBufferInvalidValueException("utf8 string", value);
return value;
}
@@ -81,7 +81,7 @@ std::string_view ByteBuffer::ReadString(uint32 length, bool requireValidUtf8 /*=
std::string_view value(reinterpret_cast<char const*>(&_storage[_rpos]), length);
_rpos += length;
if (requireValidUtf8 && !utf8::is_valid(value.begin(), value.end()))
throw ByteBufferInvalidValueException("string", value);
throw ByteBufferInvalidValueException("utf8 string", value);
return value;
}