Fix crash in image export (due to blank lines) - thx Mahdi :)

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@1044 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2012-03-15 19:42:25 +00:00
parent d32a75049b
commit aa13720843

View File

@ -540,7 +540,13 @@ namespace Nikse.SubtitleEdit.Forms
textSize = g.MeasureString(text, font);
g.Dispose();
bmp.Dispose();
bmp = new Bitmap((int)(textSize.Width * 0.8), (int)(textSize.Height * 0.7) + 10);
int sizeX = (int) (textSize.Width*0.8);
int sizeY = (int)(textSize.Height * 0.7) + 10;
if (sizeX < 1)
sizeX = 1;
if (sizeY < 1)
sizeY = 1;
bmp = new Bitmap(sizeX, sizeY);
g = Graphics.FromImage(bmp);
var lefts = new List<float>();
@ -569,7 +575,7 @@ namespace Nikse.SubtitleEdit.Forms
int i = 0;
bool isItalic = false;
float left = 5;
if (lefts.Count >= 0)
if (lefts.Count > 0)
left = lefts[0];
float top = 5;
bool newLine = false;