Fix unwanted enabling FModified flag in user manager dialog, when just switching the main tab to "Limitations", followed by a crash due to no focused user. Closes #493.

This commit is contained in:
Ansgar Becker
2019-05-26 19:24:46 +02:00
parent 493138de1c
commit 8f9abb2d3c

View File

@@ -412,7 +412,9 @@ procedure TUserManagerForm.Modification(Sender: TObject);
var
User: PUser;
begin
if Assigned(listUsers.FocusedNode) and (TWinControl(Sender).Parent = tabLimitations) then begin
if not Assigned(listUsers.FocusedNode) then
Exit;
if TWinControl(Sender).Parent = tabLimitations then begin
// Any TUpDown triggers a OnChange event on its TEdit when the UpDown gets painted
User := listUsers.GetNodeData(listUsers.FocusedNode);
Modified := Modified
@@ -420,8 +422,9 @@ begin
or (editMaxUpdates.Text <> IntToStr(User.MaxUpdates))
or (editMaxConnections.Text <> IntToStr(User.MaxConnections))
or (editMaxUserConnections.Text <> IntToStr(User.MaxUserConnections));
end else
end else begin
Modified := True;
end;
end;