From cba3aac7c111a83f229106104991b728b3290a3a Mon Sep 17 00:00:00 2001 From: niksedk Date: Thu, 5 Sep 2013 05:48:56 +0000 Subject: [PATCH] Fixed possible crash in export of images (blank line) - thx Eros UK :) git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@2058 99eadd0c-20b8-1223-b5c4-2a2b2df33de2 --- src/Forms/ExportPngXml.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Forms/ExportPngXml.cs b/src/Forms/ExportPngXml.cs index 326f340a8..136e00fe7 100644 --- a/src/Forms/ExportPngXml.cs +++ b/src/Forms/ExportPngXml.cs @@ -1344,12 +1344,15 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + baseLinePadding = 12; if (parameter.SubtitleFontSize < 25) baseLinePadding = 9; - if (lines[lines.Length - 1].Contains("g") || lines[lines.Length - 1].Contains("j") || lines[lines.Length - 1].Contains("p") || lines[lines.Length - 1].Contains("q") || lines[lines.Length - 1].Contains("y") || lines[lines.Length - 1].Contains(",")) + if (lines.Length > 0) { - string textNoBelow = lines[lines.Length - 1].Replace("g", "a").Replace("j", "a").Replace("p", "a").Replace("q", "a").Replace("y", "a").Replace(",", "a"); - baseLinePadding -= (int)Math.Round((TextDraw.MeasureTextHeight(font, lines[lines.Length - 1], parameter.SubtitleFontBold) - TextDraw.MeasureTextHeight(font, textNoBelow, parameter.SubtitleFontBold))); - if (baseLinePadding < 0) - baseLinePadding = 0; + if (lines[lines.Length - 1].Contains("g") || lines[lines.Length - 1].Contains("j") || lines[lines.Length - 1].Contains("p") || lines[lines.Length - 1].Contains("q") || lines[lines.Length - 1].Contains("y") || lines[lines.Length - 1].Contains(",")) + { + string textNoBelow = lines[lines.Length - 1].Replace("g", "a").Replace("j", "a").Replace("p", "a").Replace("q", "a").Replace("y", "a").Replace(",", "a"); + baseLinePadding -= (int)Math.Round((TextDraw.MeasureTextHeight(font, lines[lines.Length - 1], parameter.SubtitleFontBold) - TextDraw.MeasureTextHeight(font, textNoBelow, parameter.SubtitleFontBold))); + if (baseLinePadding < 0) + baseLinePadding = 0; + } } var lefts = new List();