From d6b78be9b6a2c1c6f0efaea90e1201e362548407 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Tue, 27 Jun 2017 07:52:52 +0000 Subject: [PATCH] tvplanit: Fix json demo crashing if data file does not yet exist. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5964 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/tvplanit/source/vpjsonds.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/tvplanit/source/vpjsonds.pas b/components/tvplanit/source/vpjsonds.pas index 76c898c28..2b08a5533 100644 --- a/components/tvplanit/source/vpjsonds.pas +++ b/components/tvplanit/source/vpjsonds.pas @@ -477,9 +477,12 @@ var res: TVpResource; i, j: Integer; begin - if FFileName = '' then + if (FFileName = '') then raise Exception.Create(RSNoFilenameSpecified); + if not FileExists(FFileName) then + exit; + stream := TFileStream.Create(FFilename, fmOpenRead + fmShareDenyWrite); try Resources.ClearResources;