From 92da1ea7dbd0a4d0680f15cb12fe43b5bea89bc3 Mon Sep 17 00:00:00 2001 From: niksedk Date: Sat, 25 Feb 2023 18:59:50 +0100 Subject: [PATCH] Minor refact + null guard --- src/ui/Forms/About.cs | 10 +++++----- src/ui/Logic/UiUtil.cs | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/ui/Forms/About.cs b/src/ui/Forms/About.cs index d7719ff0a..f9e940206 100644 --- a/src/ui/Forms/About.cs +++ b/src/ui/Forms/About.cs @@ -22,8 +22,8 @@ namespace Nikse.SubtitleEdit.Forms { Text = _language.Title + " - " + (IntPtr.Size * 8) + "-bit"; okButton.Text = _languageGeneral.Ok; - string[] versionInfo = Utilities.AssemblyVersion.Split('.'); - string revisionNumber = "0"; + var versionInfo = Utilities.AssemblyVersion.Split('.'); + var revisionNumber = "0"; if (versionInfo.Length >= 4) { revisionNumber = versionInfo[3]; @@ -43,9 +43,9 @@ namespace Nikse.SubtitleEdit.Forms linkLabelGitBuildHash.Font = labelProduct.Font; } - string aboutText = _language.AboutText1.TrimEnd() + Environment.NewLine + - Environment.NewLine + - _languageGeneral.TranslatedBy.Trim(); + var aboutText = _language.AboutText1.TrimEnd() + Environment.NewLine + + Environment.NewLine + + _languageGeneral.TranslatedBy.Trim(); while (aboutText.Contains("\n ") || aboutText.Contains("\n\t")) { aboutText = aboutText.Replace("\n ", "\n"); diff --git a/src/ui/Logic/UiUtil.cs b/src/ui/Logic/UiUtil.cs index 17793144c..9fedae471 100644 --- a/src/ui/Logic/UiUtil.cs +++ b/src/ui/Logic/UiUtil.cs @@ -685,6 +685,11 @@ namespace Nikse.SubtitleEdit.Logic public static void FixLargeFonts(Control mainCtrl, Control ctrl) { + if (mainCtrl == null || ctrl == null) + { + return; + } + using (var graphics = mainCtrl.CreateGraphics()) { var textSize = graphics.MeasureString(ctrl.Text, ctrl.Font);