소스 검색

minor fix to font change method to better handle nulls

randoman 6 년 전
부모
커밋
5f2f19adde
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      src/XUnity.AutoTranslator.Plugin.Core/TranslationInfo.cs

+ 2 - 2
src/XUnity.AutoTranslator.Plugin.Core/TranslationInfo.cs

@@ -66,9 +66,9 @@ namespace XUnity.AutoTranslator.Plugin.Core
             var ui = graphic as Text;
 
             var previousFont = ui.font;
-            var newFont = FontCache.GetOrCreate( previousFont.fontSize );
+            var newFont = FontCache.GetOrCreate( previousFont?.fontSize ?? ui.fontSize );
 
-            if( newFont != previousFont )
+            if( !ReferenceEquals( newFont, previousFont ) )
             {
                ui.font = newFont;
                _unfont = obj =>