Skip to content

Commit

Permalink
minor fix to font change method to better handle nulls
Browse files Browse the repository at this point in the history
  • Loading branch information
randoman committed Oct 20, 2018
1 parent ef69c56 commit 5f2f19a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/XUnity.AutoTranslator.Plugin.Core/TranslationInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public void ChangeFont( object graphic )
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 =>
Expand Down

0 comments on commit 5f2f19a

Please sign in to comment.