Skip to content

Commit da07591

Browse files
committed
fix: potentially crashing typecast in LoadRecentFilter
Refs #2411
1 parent 31ba8bf commit da07591

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

source/main.pas

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12047,8 +12047,13 @@ procedure TMainForm.LoadRecentFilter(Sender: TObject);
1204712047
// Event handler for both dynamic popup menu items and filter combobox
1204812048
if Sender is TMenuItem then
1204912049
key := (Sender as TMenuItem).Tag
12050-
else
12051-
key := (Sender as TComboBox).ItemIndex+1;
12050+
else if Sender is TComboBox then
12051+
key := (Sender as TComboBox).ItemIndex+1
12052+
else begin
12053+
Beep;
12054+
LogSQL('Unhandled '+Sender.ClassName+' in LoadRecentFilter');
12055+
Exit;
12056+
end;
1205212057
Path := AppSettings.AppendDelimiter(GetRegKeyTable) + REGKEY_RECENTFILTERS;
1205312058
if AppSettings.SessionPathExists(Path) then begin
1205412059
AppSettings.SessionPath := Path;

0 commit comments

Comments
 (0)