🚨 Guard location name serialization against empty strings

Saving or loading an unnamed location indexed the first character
of an empty string.
This commit is contained in:
2026-11-15 22:08:32 +01:00
parent 4d9e02aaef
commit b47292a4bc
+5
View File
@@ -1977,8 +1977,12 @@ begin
Stream.Read(locationInfo^.Y, SizeOf(Word)); Stream.Read(locationInfo^.Y, SizeOf(Word));
stringLength := 0; stringLength := 0;
Stream.Read(stringLength, SizeOf(Integer)); Stream.Read(stringLength, SizeOf(Integer));
if stringLength > 0 then
begin
SetLength(s, stringLength); SetLength(s, stringLength);
Stream.Read(s[1], stringLength); Stream.Read(s[1], stringLength);
end else
SetLength(s, 0);
locationInfo^.Name := s; locationInfo^.Name := s;
end; end;
@@ -2005,6 +2009,7 @@ begin
Stream.Write(locationInfo^.Y, SizeOf(Word)); Stream.Write(locationInfo^.Y, SizeOf(Word));
stringLength := Length(locationInfo^.Name); stringLength := Length(locationInfo^.Name);
Stream.Write(stringLength, SizeOf(Integer)); Stream.Write(stringLength, SizeOf(Integer));
if stringLength > 0 then
Stream.Write(locationInfo^.Name[1], stringLength); Stream.Write(locationInfo^.Name[1], stringLength);
end; end;