Skip to content

Commit 58ffeb9

Browse files
committed
fix: crash in grid export with no focused column and usage of IfThen() which evaluates all arguments before the function is called
Refs #2519
1 parent ab7923d commit 58ffeb9

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

source/exportgrid.pas

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,10 @@ procedure TfrmExportGrid.FormShow(Sender: TObject);
241241
chkFocusedColumnOnly.OnClick := CalcSize;
242242
CalcSize(Sender);
243243
// Show name of focused column
244-
FocusedCol := IfThen(Grid.FocusedColumn > NoColumn, Grid.Header.Columns[Grid.FocusedColumn].Text, '');
244+
if Grid.FocusedColumn > -1 then
245+
FocusedCol := Grid.Header.Columns[Grid.FocusedColumn].Text
246+
else
247+
FocusedCol := '';
245248
chkFocusedColumnOnly.Caption := f_('Only focused column (%s)', [FocusedCol]);
246249
chkFocusedColumnOnly.Enabled := not FocusedCol.IsEmpty;
247250
end;

0 commit comments

Comments
 (0)