From 544d1b35cdf332fd6388b7d607eec64d5bbfdf7f Mon Sep 17 00:00:00 2001 From: ManlyMarco <39247311+ManlyMarco@users.noreply.github.com> Date: Sun, 27 Oct 2024 22:13:53 +0100 Subject: [PATCH] Don't create override font if previousFont is null anyways --- src/XUnity.AutoTranslator.Plugin.Core/TextTranslationInfo.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/XUnity.AutoTranslator.Plugin.Core/TextTranslationInfo.cs b/src/XUnity.AutoTranslator.Plugin.Core/TextTranslationInfo.cs index 24598de8..9036b56c 100644 --- a/src/XUnity.AutoTranslator.Plugin.Core/TextTranslationInfo.cs +++ b/src/XUnity.AutoTranslator.Plugin.Core/TextTranslationInfo.cs @@ -129,8 +129,9 @@ public void ChangeFont( object ui ) var fontProperty = clrType.CachedProperty( "font" ); var previousFont = fontProperty.Get( ui ); + if( previousFont == null ) return; var newFont = FontCache.GetOrCreateOverrideFontTextMeshPro(); - if( newFont == null || previousFont == null ) return; + if( newFont == null ) return; if( !UnityObjectReferenceComparer.Default.Equals( newFont, previousFont ) ) {