🚨 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
+8 -3
View File
@@ -1977,8 +1977,12 @@ begin
Stream.Read(locationInfo^.Y, SizeOf(Word));
stringLength := 0;
Stream.Read(stringLength, SizeOf(Integer));
SetLength(s, stringLength);
Stream.Read(s[1], stringLength);
if stringLength > 0 then
begin
SetLength(s, stringLength);
Stream.Read(s[1], stringLength);
end else
SetLength(s, 0);
locationInfo^.Name := s;
end;
@@ -2005,7 +2009,8 @@ begin
Stream.Write(locationInfo^.Y, SizeOf(Word));
stringLength := Length(locationInfo^.Name);
Stream.Write(stringLength, SizeOf(Integer));
Stream.Write(locationInfo^.Name[1], stringLength);
if stringLength > 0 then
Stream.Write(locationInfo^.Name[1], stringLength);
end;
procedure TfrmMain.vstUoaDesignsDblClick(Sender: TObject);