🚨 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:
+8
-3
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user