]> granicus.if.org Git - pdns/commitdiff
Remove possible devision by zero (coverity fix)
authorRuben d'Arco <cyclops@prof-x.net>
Fri, 16 Aug 2013 16:59:25 +0000 (18:59 +0200)
committerRuben d'Arco <cyclops@prof-x.net>
Fri, 16 Aug 2013 16:59:25 +0000 (18:59 +0200)
pdns/ws.cc

index 36e43147f408744b711e5cff3318a8eb00422639..994223869816c4d2607e252743355be88d83e777 100644 (file)
@@ -93,9 +93,13 @@ void *StatWebServer::threadHelper(void *p)
 
 void printtable(ostringstream &ret, const string &ringname, const string &title, int limit=10)
 {
+  vector<pair <string,unsigned int> >ring=S.getRing(ringname);
+  if (ring.size() == 0) {
+    return;
+  }
+
   int tot=0;
   int entries=0;
-  vector<pair <string,unsigned int> >ring=S.getRing(ringname);
 
   for(vector<pair<string, unsigned int> >::const_iterator i=ring.begin(); i!=ring.end();++i) {
     tot+=i->second;