From c62aa4835790806f6f66be77ff83322c2b55b861 Mon Sep 17 00:00:00 2001
From: "jonathan.ehret" <ehret@vr.rwth-aachen.de>
Date: Tue, 11 Jul 2023 21:25:13 +0200
Subject: [PATCH] fix crash when file is send for the first time

---
 LaunchScript/VirtualAcousticsStarterServer.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/LaunchScript/VirtualAcousticsStarterServer.py b/LaunchScript/VirtualAcousticsStarterServer.py
index d5f6817..3bedbb2 100644
--- a/LaunchScript/VirtualAcousticsStarterServer.py
+++ b/LaunchScript/VirtualAcousticsStarterServer.py
@@ -428,9 +428,12 @@ class VirtualAcousticsLauncher:
       if iLocalFileLastModification<iLastModificationTime:
         bNewerFileExists = True
 
+    iLocalFileSize = 0
+    if os.path.isfile(Fullpath+Filename):
+      iLocalFileSize = os.stat(Fullpath+Filename).st_size
+
     #check whether the file with this exact size (which is not older than the file to send) already exists
-    iLocalFileSize = os.stat(Fullpath+Filename).st_size
-    if os.path.isfile(Fullpath+Filename) and iLocalFileSize == iBytesToReceive and not bNewerFileExists :
+    if iLocalFileSize == iBytesToReceive and not bNewerFileExists :
       self.oLauncherConnection.send( b'exists' )
       print("File already exists (same size, and more recent modification time), so no need for resending")
 
-- 
GitLab