hedgewars/uVideoRec.pas
changeset 13518 d8462cc9d42d
parent 13500 b5f8864a38d3
child 14204 3c36a4e66c82
--- 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;