From 6f6f9e7fd02a399ada6b2457d92294c626f86c82 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Tue, 14 Jun 2016 20:50:36 +0200 Subject: [PATCH] Fixed crash in Final Cut Pro + image - thx imyourshadow :) Fix #1790 --- src/Forms/ExportPngXml.cs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Forms/ExportPngXml.cs b/src/Forms/ExportPngXml.cs index 2e0400457..0fc1c5045 100644 --- a/src/Forms/ExportPngXml.cs +++ b/src/Forms/ExportPngXml.cs @@ -1639,17 +1639,22 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + _subtitleFontSize = float.Parse(comboBoxSubtitleFontSize.SelectedItem.ToString()); _subtitleFontBold = checkBoxBold.Checked; - if (comboBoxBorderWidth.SelectedItem.ToString() == Configuration.Settings.Language.ExportPngXml.BorderStyleBoxForEachLine) + _borderWidth = GetBorderWidth(); + } + + private float GetBorderWidth() + { + if (comboBoxBorderWidth.SelectedItem.ToString() == Configuration.Settings.Language.ExportPngXml.BorderStyleBoxForEachLine || + comboBoxBorderWidth.SelectedItem.ToString() == Configuration.Settings.Language.ExportPngXml.BorderStyleOneBox) { - _borderWidth = 0; - } - else if (comboBoxBorderWidth.SelectedItem.ToString() == Configuration.Settings.Language.ExportPngXml.BorderStyleOneBox) - { - _borderWidth = 0; + return 0; } else { - _borderWidth = float.Parse(Utilities.RemoveNonNumbers(comboBoxBorderWidth.SelectedItem.ToString())); + float f; + if (float.TryParse(Utilities.RemoveNonNumbers(comboBoxBorderWidth.SelectedItem.ToString()), out f)) + return f; + return 0; } } @@ -3191,7 +3196,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + { } } - _borderWidth = float.Parse(Utilities.RemoveNonNumbers(comboBoxBorderWidth.SelectedItem.ToString())); + _borderWidth = GetBorderWidth(); checkBoxBold.Checked = Configuration.Settings.Tools.ExportLastFontBold; if (Configuration.Settings.Tools.Export3DType >= 0 && Configuration.Settings.Tools.Export3DType < comboBox3D.Items.Count)