Browse Source

Fix possible uncaught exception

Ivan Savenko 2 years ago
parent
commit
26bddbac44
1 changed files with 8 additions and 1 deletions
  1. 8 1
      lib/vstd/DateUtils.cpp

+ 8 - 1
lib/vstd/DateUtils.cpp

@@ -10,7 +10,14 @@ namespace vstd
 	{
 		std::tm tm = *std::localtime(&dt);
 		std::stringstream s;
-		s.imbue(std::locale(""));
+		try
+		{
+			s.imbue(std::locale(""));
+		}
+		catch(const std::runtime_error & e)
+		{
+			// locale not be available - keep default / global
+		}
 		s << std::put_time(&tm, "%x %X");
 		return s.str();
 	}