浏览代码

Fixed log window exceptions when parsing invalid filenames

BearishSun 9 年之前
父节点
当前提交
7eabda8a28
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      Source/MBansheeEditor/Windows/LogWindow.cs

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

@@ -505,7 +505,14 @@ namespace BansheeEditor
                 string method = "";
                 string method = "";
                 if (data.callstack != null && data.callstack.Length > 0)
                 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;
                     line = data.callstack[0].line;
 
 
                     if (string.IsNullOrEmpty(data.callstack[0].method))
                     if (string.IsNullOrEmpty(data.callstack[0].method))