diff options
author | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-05-23 17:00:52 +0000 |
---|---|---|
committer | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-05-23 17:00:52 +0000 |
commit | 0df43e29d3d12f93fd4ace638cfb60b65dd32262 (patch) | |
tree | 7a55602f2f5dae49c6662a8b13f0542f7a4eefe6 /Game | |
parent | 8d45ef9b08de96a0037ac9e245a84b7730228736 (diff) | |
download | usdx-0df43e29d3d12f93fd4ace638cfb60b65dd32262.tar.gz usdx-0df43e29d3d12f93fd4ace638cfb60b65dd32262.tar.xz usdx-0df43e29d3d12f93fd4ace638cfb60b65dd32262.zip |
Fixed a Bug that can cause the application crashes, when Song Data is missing.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@226 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game')
-rw-r--r-- | Game/Code/Classes/UFiles.pas | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index aa336233..ee1935cd 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -239,9 +239,12 @@ begin end
// Video File
- else if (Identifier = 'VIDEO') AND (FileExists(Song.Path + Value)) then
+ else if (Identifier = 'VIDEO') then
begin
- Song.Video := Value;
+ if (FileExists(Song.Path + Value)) then
+ Song.Video := Value
+ else
+ Log.LogError('Can''t find Video File in Song: ' + Song.Path + Song.FileName);
end
// Video Gap
@@ -579,6 +582,7 @@ begin Result := ReadTxTHeader(AktSong);
if not Result then
begin
+ CloseFile(SongFile);
Log.LogError('Error Loading SongHeader, abort Song Loading');
Exit;
end;
@@ -594,6 +598,7 @@ begin if (EoF(SongFile)) then
begin //Song File Corrupted - No Notes
+ CloseFile(SongFile);
Log.LogError('Could not load txt File, no Notes found: ' + Name);
Result := False;
Exit;
@@ -617,7 +622,6 @@ begin // TempC := Tekst[1]; // read from backup variable, don't use default ':' value
while (TempC <> 'E') AND (not EOF(SongFile)) do begin
- Inc(FileLineNo);
if (TempC = ':') or (TempC = '*') or (TempC = 'F') then begin
// wczytuje nute
Read(SongFile, Param1);
@@ -688,10 +692,17 @@ begin end;
Read(SongFile, TempC);
+ Inc(FileLineNo);
end; // while}
CloseFile(SongFile);
except
+ try
+ CloseFile(SongFile);
+ except
+
+ end;
+
Log.LogError('Error Loading File: "' + Name + '" in Line ' + inttostr(FileLineNo));
exit;
end;
|