Skip to content

Commit

Permalink
[gui]: Use TRequestFilter.GetByName when adding a new filter
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinDrab committed Jun 22, 2019
1 parent 7024f15 commit 86bb11c
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions gui/FillterForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,6 @@
hc : TColor;
err : Cardinal;
passTarget : TRequestFilter;
nameExists : Boolean;
newName : WideString;
begin
f := Nil;
Expand Down Expand Up @@ -534,21 +533,14 @@
FilterValueComboBox.Text + '-' +
FilterActionComboBox.Text;

nameExists := False;
For f In FFilterList Do
begin
nameExists := f.Name = newName;
If nameExists Then
Break;
end;

f := Nil;
If nameExists Then
f := TRequestFilter.GetByName(newName, FFilterList);
If Assigned(f) Then
begin
ErrorMessage('The filter is already present in the list');
Exit;
end;

f := Nil;
f := TRequestFilter.NewInstance(rt);
If Not Assigned(f) Then
Exit;
Expand Down

0 comments on commit 86bb11c

Please sign in to comment.