From 97f6e90678a66993e01f4ca0fddaa3c172077631 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Sat, 2 May 2020 09:31:58 +0000 Subject: [PATCH] LazStats: Load data files only when they have extension .laz. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7424 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- applications/lazstats/source/units/dataprocs.pas | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/applications/lazstats/source/units/dataprocs.pas b/applications/lazstats/source/units/dataprocs.pas index 0774644ba..9efe1cd73 100644 --- a/applications/lazstats/source/units/dataprocs.pas +++ b/applications/lazstats/source/units/dataprocs.pas @@ -296,7 +296,7 @@ end; procedure OpenOS2File; begin OS3MainFrm.OpenDialog1.DefaultExt := '.laz'; - OS3MainFrm.OpenDialog1.Filter := 'LazStats (*.laz)|*.laz;*.LAZ|All files (*.*)|*.*'; + OS3MainFrm.OpenDialog1.Filter := 'LazStats files (*.laz)|*.laz;*.LAZ|All files (*.*)|*.*'; OS3MainFrm.OpenDialog1.FilterIndex := 1; if OS3MainFrm.OpenDialog1.Execute then OpenOS2File(OS3MainFrm.OpenDialog1.FileName, true); @@ -309,6 +309,12 @@ var i, j: integer; NRows, NCols: integer; begin + if Lowercase(ExtractFileExt(AFileName)) <> '.laz' then + begin + MessageDlg(Format('Incorrect file format ("%s")', [AFileName]), mtError, [mbOK], 0); + exit; + end; + DictLoaded := false; OS3MainFrm.FileNameEdit.Text := ExpandFileName(AFileName);