diff --git a/cmake/scripts/check-format-1.sh b/cmake/scripts/check-format-1.sh
index f4ce7c6016f87d011d7bff7a9f2b2e052537e7da..33b2a5d3b710497e98a06ce7fd80ae238bed0996 100755
--- a/cmake/scripts/check-format-1.sh
+++ b/cmake/scripts/check-format-1.sh
@@ -6,6 +6,12 @@ outfile=$2
 BASE_COMMIT=${FAIRROOT_FORMAT_BASE:-HEAD}
 GIT_CLANG_FORMAT_BIN=${FAIRROOT_GIT_CLANG_FORMAT_BIN:-git-clang-format}
 
+# special case when a file was deleted
+# don't run the test in such a case
+if [ ! -e $infile ]; then 
+  exit 0
+fi
+
 RESULT=$($GIT_CLANG_FORMAT_BIN --commit $BASE_COMMIT --diff $infile --extensions h,hpp,c,C,cpp,cxx,tpl)
 
 if [ "$RESULT" == "no modified files to format" ] || [ "$RESULT" == "clang-format did not modify any files" ]; then