소스 검색

Fix problems when launching game without console enabled

Bepis 6 년 전
부모
커밋
de90fd9ffe
1개의 변경된 파일14개의 추가작업 그리고 11개의 파일을 삭제
  1. 14 11
      BepInEx/ConsoleUtil/ConsoleWindow.cs

+ 14 - 11
BepInEx/ConsoleUtil/ConsoleWindow.cs

@@ -47,18 +47,21 @@ namespace UnityInjector.ConsoleUtil
         {
             set
             {
-                if (value == null)
+                if (_attached)
                 {
-                    throw new ArgumentNullException(nameof(value));
-                }
-                if (value.Length > 24500)
-                {
-                    throw new InvalidOperationException("Console title too long");
-                }
-
-                if (!SetConsoleTitle(value))
-                {
-                    throw new InvalidOperationException("Console title invalid");
+                    if (value == null)
+                    {
+                        throw new ArgumentNullException(nameof(value));
+                    }
+                    if (value.Length > 24500)
+                    {
+                        throw new InvalidOperationException("Console title too long");
+                    }
+
+                    if (!SetConsoleTitle(value))
+                    {
+                        throw new InvalidOperationException("Console title invalid");
+                    }
                 }
             }
         }