From b47292a4bc4985c9f60dc974d005bffa933f49b1 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sun, 15 Nov 2026 14:25:59 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20Guard=20location=20name=20serial?= =?UTF-8?q?ization=20against=20empty=20strings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Saving or loading an unnamed location indexed the first character of an empty string. --- Client/UfrmMain.pas | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Client/UfrmMain.pas b/Client/UfrmMain.pas index 9c7459f..a66024f 100644 --- a/Client/UfrmMain.pas +++ b/Client/UfrmMain.pas @@ -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);