Minor refact + null guard

This commit is contained in:
niksedk 2023-02-25 18:59:50 +01:00
parent 7f7b43d9a0
commit 92da1ea7db
2 changed files with 10 additions and 5 deletions

View File

@ -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,7 +43,7 @@ namespace Nikse.SubtitleEdit.Forms
linkLabelGitBuildHash.Font = labelProduct.Font;
}
string aboutText = _language.AboutText1.TrimEnd() + Environment.NewLine +
var aboutText = _language.AboutText1.TrimEnd() + Environment.NewLine +
Environment.NewLine +
_languageGeneral.TranslatedBy.Trim();
while (aboutText.Contains("\n ") || aboutText.Contains("\n\t"))

View File

@ -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);