Fixed Serializer::ReadStr.

This commit is contained in:
Arron David Nelson 2024-02-17 00:52:03 -08:00
parent b1adf15f89
commit 7cdd57cc5f

View File

@ -1071,7 +1071,9 @@ namespace ehs
template<typename T, typename O> template<typename T, typename O>
Str<T, O> ReadStr(O size = 0) Str<T, O> ReadStr(O size = 0)
{ {
if (!size) bool sizeKnown = size;
if (!sizeKnown)
while (&data[offset + sizeof(T) * size]) while (&data[offset + sizeof(T) * size])
size++; size++;
@ -1096,7 +1098,10 @@ namespace ehs
Util::Copy(&result[0], &data[offset], result.Size(true)); Util::Copy(&result[0], &data[offset], result.Size(true));
} }
offset += result.Size(true) + 1; offset += result.Size(true);
if (!sizeKnown)
offset++;
return result; return result;
} }