# HG changeset patch
# User Wuzzy <Wuzzy2@mail.ru>
# Date 1532021728 -7200
# Node ID d8462cc9d42d9a6181ecfe816081cab829678d78
# Parent  4c5c8a83e29881d60436fe09ad63520a957f175c
Fix engine crash when trying to delete cameraFile but it doesn't exist

diff -r 4c5c8a83e298 -r d8462cc9d42d hedgewars/uVideoRec.pas
--- a/hedgewars/uVideoRec.pas	Thu Jul 19 19:11:39 2018 +0200
+++ b/hedgewars/uVideoRec.pas	Thu Jul 19 19:35:28 2018 +0200
@@ -157,8 +157,15 @@
         AddFileLog('AVWrapper_Close() has failed.');
         halt(HaltVideoRec);
         end;
-    Erase(cameraFile);
-    if recordAudio then
+{$IOCHECKS OFF}
+    // Provoke IOResult to be set
+    FileSize(cameraFile);
+    if IOResult = 0 then
+        Erase(cameraFile)
+    else
+        AddFileLog('Warning: Tried to delete the cameraFile but it was already deleted');
+{$IOCHECKS ON}
+    if recordAudio and FileExists(soundFilePath) then
         DeleteFile(soundFilePath);
     SendIPC(_S'v'); // inform frontend that we finished
 end;