diff --git a/Common/StringUtils.cpp b/Common/StringUtils.cpp
index 827c1dc29fc7d191cadf8308859f78f089836735..8378af230c7e795c4b468334425dcb5b47b5afd8 100644
--- a/Common/StringUtils.cpp
+++ b/Common/StringUtils.cpp
@@ -91,17 +91,20 @@ std::string FixRelativePath(const std::string &reference, const std::string &in)
 
 std::vector<std::string> SplitFileName(const std::string &fileName)
 {
-  // returns [path, baseName, extension]
-  int idot = (int)fileName.find_last_of('.');
-  int islash = (int)fileName.find_last_of("/\\");
-  if(idot == (int)std::string::npos) idot = -1;
-  if(islash == (int)std::string::npos) islash = -1;
-  std::vector<std::string> s; s.resize(3); // JFR DO NOT CHANGE TO std::vector<std::string> s(3), it segfaults while destructor si called 
-  if(idot > 0)
-    s[2] = fileName.substr(idot);
-  if(islash > 0)
-    s[0] = fileName.substr(0, islash + 1);
-  s[1] = fileName.substr(s[0].size(), fileName.size() - s[0].size() - s[2].size());
+  // JFR DO NOT CHANGE TO std::vector<std::string> s(3), it segfaults while destructor si called 
+  std::vector<std::string> s; s.resize(3);
+  if(fileName.size()){
+    // returns [path, baseName, extension]
+    int idot = (int)fileName.find_last_of('.');
+    int islash = (int)fileName.find_last_of("/\\");
+    if(idot == (int)std::string::npos) idot = -1;
+    if(islash == (int)std::string::npos) islash = -1;
+    if(idot > 0)
+      s[2] = fileName.substr(idot);
+    if(islash > 0)
+      s[0] = fileName.substr(0, islash + 1);
+    s[1] = fileName.substr(s[0].size(), fileName.size() - s[0].size() - s[2].size());
+  }
   return s;
 }