Explorar o código

Fixed log window exceptions when parsing invalid filenames

BearishSun %!s(int64=9) %!d(string=hai) anos
pai
achega
7eabda8a28
Modificáronse 1 ficheiros con 8 adicións e 1 borrados
  1. 8 1
      Source/MBansheeEditor/Windows/LogWindow.cs

+ 8 - 1
Source/MBansheeEditor/Windows/LogWindow.cs

@@ -505,7 +505,14 @@ namespace BansheeEditor
                 string method = "";
                 if (data.callstack != null && data.callstack.Length > 0)
                 {
-                    file = Path.GetFileName(data.callstack[0].file);
+                    string filePath = data.callstack[0].file;
+                    bool isFilePathValid = filePath.IndexOfAny(Path.GetInvalidPathChars()) == -1;
+
+                    if (isFilePathValid)
+                        file = Path.GetFileName(data.callstack[0].file);
+                    else
+                        file = "<unknown file>";
+
                     line = data.callstack[0].line;
 
                     if (string.IsNullOrEmpty(data.callstack[0].method))