From 1f82efa02cf564ea9afd08b9be82644f1b07dd02 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Tue, 15 Dec 2020 07:21:15 +0100 Subject: [PATCH] Fix sporadic crash in Tconnform.TimerStatisticsTimer due to empty session path --- source/connections.pas | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/connections.pas b/source/connections.pas index e7881610..6a71918b 100644 --- a/source/connections.pas +++ b/source/connections.pas @@ -633,8 +633,12 @@ function Tconnform.SelectedSessionPath: String; var Sess: PConnectionParameters; begin - Sess := ListSessions.GetNodeData(ListSessions.FocusedNode); - Result := Sess.SessionPath; + if not Assigned(ListSessions.FocusedNode) then + Result := '' + else begin + Sess := ListSessions.GetNodeData(ListSessions.FocusedNode); + Result := Sess.SessionPath; + end; end; @@ -1010,6 +1014,9 @@ begin Exit; AppSettings.SessionPath := SelectedSessionPath; + if AppSettings.SessionPath.IsEmpty then + Exit; + DummyDate := StrToDateTime('2000-01-01'); LastConnect := StrToDateTimeDef(AppSettings.ReadString(asLastConnect), DummyDate); if LastConnect <> DummyDate then begin