mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
CSV scanner: fix crash when selected filename cannot be opened
This commit is contained in:
@ -125,6 +125,7 @@ begin
|
||||
Screen.Cursor := crHourGlass;
|
||||
btnScan.ImageIndex := 150;
|
||||
btnScan.Enabled := False;
|
||||
btnSave.Enabled := False;
|
||||
// Parse contents to a TGridRows instance
|
||||
GridRows := TGridRows.Create(True);
|
||||
GridRow := nil;
|
||||
@ -144,6 +145,7 @@ begin
|
||||
|
||||
InEncl := False;
|
||||
|
||||
try
|
||||
MainForm.ShowStatusMsg(f_('Reading textfile (%s) ...', [FormatByteNumber(TestChunkSize)]));
|
||||
Encoding := FLoadDataFrm.FileEncoding;
|
||||
OpenTextfile(FLoadDataFrm.editFilename.Text, Stream, Encoding);
|
||||
@ -194,7 +196,11 @@ begin
|
||||
// Find matching column types for values
|
||||
Columns := DetectColumnAttributes(GridRows, IgnoreLines);
|
||||
SynMemoCreateTable.Text := ComposeCreateStatement(Columns);
|
||||
|
||||
btnSave.Enabled := True;
|
||||
except
|
||||
on E:EFOpenError do
|
||||
ErrorDialog(E.Message);
|
||||
end;
|
||||
GridRows.Free;
|
||||
|
||||
MainForm.ShowStatusMsg;
|
||||
|
Reference in New Issue
Block a user