diff --git a/Client/UfrmLogin.pas b/Client/UfrmLogin.pas index ad44ba8..ec37586 100644 --- a/Client/UfrmLogin.pas +++ b/Client/UfrmLogin.pas @@ -128,11 +128,14 @@ begin if InputQuery('Save profile', 'Enter the name of the profile:', profileName) then begin profile := TIniFile.Create(FProfilePath + profileName + '.ini'); - profile.WriteString('Connection', 'Host', edHost.Text); - profile.WriteInteger('Connection', 'Port', edPort.Value); - profile.WriteString('Connection', 'Username', edUsername.Text); - profile.WriteString('Data', 'Path', edData.Text); - profile.Free; + try + profile.WriteString('Connection', 'Host', edHost.Text); + profile.WriteInteger('Connection', 'Port', edPort.Value); + profile.WriteString('Connection', 'Username', edUsername.Text); + profile.WriteString('Data', 'Path', edData.Text); + finally + profile.Free; + end; cbProfile.ItemIndex := cbProfile.Items.IndexOf(profileName); if cbProfile.ItemIndex = -1 then begin @@ -149,13 +152,16 @@ begin if cbProfile.ItemIndex > -1 then begin profile := TIniFile.Create(FProfilePath + cbProfile.Text + '.ini'); - edHost.Text := profile.ReadString('Connection', 'Host', ''); - edPort.Value := profile.ReadInteger('Connection', 'Port', 2597); - edUsername.Text := profile.ReadString('Connection', 'Username', ''); - edPassword.Text := ''; - edData.Text := profile.ReadString('Data', 'Path', ''); - edPassword.SetFocus; - profile.Free; + try + edHost.Text := profile.ReadString('Connection', 'Host', ''); + edPort.Value := profile.ReadInteger('Connection', 'Port', 2597); + edUsername.Text := profile.ReadString('Connection', 'Username', ''); + edPassword.Text := ''; + edData.Text := profile.ReadString('Data', 'Path', ''); + edPassword.SetFocus; + finally + profile.Free; + end; end; end;