瀏覽代碼

"handling" of null reference exception

Scrublord1336 6 年之前
父節點
當前提交
9f94edb8fd
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      src/XUnity.AutoTranslator.Plugin.Core/AutoTranslationPlugin.cs

+ 5 - 1
src/XUnity.AutoTranslator.Plugin.Core/AutoTranslationPlugin.cs

@@ -400,9 +400,13 @@ namespace XUnity.AutoTranslator.Plugin.Core
                   info?.UnresizeUI( ui );
                }
             }
+            catch( NullReferenceException )
+            {
+               // This is likely happened due to a scene change.
+            }
             catch( Exception e )
             {
-               Console.WriteLine( "[XUnity.AutoTranslator][WARN]: An error occurred while setting text on a component. This is likely happened due to a scene change." + Environment.NewLine + e );
+               Console.WriteLine( "[XUnity.AutoTranslator][ERROR]: An error occurred while setting text on a component." + Environment.NewLine + e );
             }
             finally
             {