From 87a601cc1528279b675a56131ef1061aa124f732 Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 21 Aug 2008 13:17:41 +0000 Subject: check if projectm_create1 succeeds git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1285 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/lib/projectM/projectM-1_0.inc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Game/Code/lib/projectM') diff --git a/Game/Code/lib/projectM/projectM-1_0.inc b/Game/Code/lib/projectM/projectM-1_0.inc index 1b03f17c..8e84894d 100644 --- a/Game/Code/lib/projectM/projectM-1_0.inc +++ b/Game/Code/lib/projectM/projectM-1_0.inc @@ -85,10 +85,12 @@ begin // we cannot catch C++ exceptions in delphi, so we have to check // if configFile is valid first - if (FileExists(configFile)) then - data := _projectM_create1(PChar(configFile)) - else + if (not FileExists(configFile)) then raise Exception.Create('Invalid file: ' + configFile); + + data := _projectM_create1(PChar(configFile)); + if (data = nil) then + raise Exception.Create('Creation of projectM object failed'); end; procedure TProjectM.ResetGL(width, height: Integer); -- cgit v1.2.3