Fix division by zero.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-01-05 13:11:18 +02:00
parent 1882833ce7
commit d4317a61ec

View File

@ -180,7 +180,12 @@ const TextLine& VTextManager::GetSourceLine(int i) const
*/ */
void VTextManager::FitFontSize(qreal fW, qreal fH) void VTextManager::FitFontSize(qreal fW, qreal fH)
{ {
int iFS = 3*qFloor(fH/GetSourceLinesCount())/4; int iFS = 0;
if (GetSourceLinesCount() > 0)
{//division by zero
iFS = 3*qFloor(fH/GetSourceLinesCount())/4;
}
if (iFS < MIN_FONT_SIZE) if (iFS < MIN_FONT_SIZE)
{ {
iFS = MIN_FONT_SIZE; iFS = MIN_FONT_SIZE;