From d4317a61ecf5d4b97d680335e030775b0f4e59a5 Mon Sep 17 00:00:00 2001
From: Roman Telezhynskyi <kroluku@gmail.com>
Date: Thu, 5 Jan 2017 13:11:18 +0200
Subject: [PATCH] Fix division by zero.

--HG--
branch : develop
---
 src/libs/vlayout/vtextmanager.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/libs/vlayout/vtextmanager.cpp b/src/libs/vlayout/vtextmanager.cpp
index 55408a285..1f49bed26 100644
--- a/src/libs/vlayout/vtextmanager.cpp
+++ b/src/libs/vlayout/vtextmanager.cpp
@@ -180,7 +180,12 @@ const TextLine& VTextManager::GetSourceLine(int i) const
  */
 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)
     {
         iFS = MIN_FONT_SIZE;