Prevent div by zero
authorunc0rr
Wed, 25 Dec 2013 11:52:09 +0400
changeset 9852 0a5ec79af0a2
parent 9850 c14c5e2f9d69
child 9853 8786d4ac9e0b
Prevent div by zero
QTfrontend/ui/page/pagemain.cpp
--- a/QTfrontend/ui/page/pagemain.cpp	Tue Dec 24 18:39:23 2013 -0500
+++ b/QTfrontend/ui/page/pagemain.cpp	Wed Dec 25 11:52:09 2013 +0400
@@ -158,7 +158,7 @@
 #else
     int platform = 3;
 #endif
-    if(Tips.length() == 0)
+    if(!Tips.length())
     {
         DataManager & dataMgr = DataManager::instance();
 
@@ -209,7 +209,11 @@
 
         file.close();
     }
-    return Tips[QTime(0, 0, 0).secsTo(QTime::currentTime()) % Tips.length()];
+    
+    if(Tips.length())
+        return Tips[QTime(0, 0, 0).secsTo(QTime::currentTime()) % Tips.length()];
+    else
+        return QString();
 }
 
 void PageMain::toggleNetworkChoice()