]> granicus.if.org Git - pdns/commitdiff
don't process any non-existing additional processing
authorBert Hubert <bert.hubert@netherlabs.nl>
Thu, 15 Oct 2009 18:41:40 +0000 (18:41 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Thu, 15 Oct 2009 18:41:40 +0000 (18:41 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1436 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/syncres.cc

index bda6c75ad58fe75248366693d27a978a72f80014..b0fe69311289cfe6f384b0df9118f76a90c589c8 100644 (file)
@@ -1143,12 +1143,14 @@ void SyncRes::addCruft(const string &qname, vector<DNSResourceRecord>& ret)
       doResolve(host, *l_doIPv6AP ? QType(QType::ADDR) : QType(QType::A), addit, 1, beenthere);
     }
   
-  sort(addit.begin(), addit.end());
-  addit.erase(unique(addit.begin(), addit.end(), uniqueComp), addit.end());
-  for(vector<DNSResourceRecord>::iterator k=addit.begin();k!=addit.end();++k) {
-    if(k->qtype.getCode()==QType::A || k->qtype.getCode()==QType::AAAA) {
-      k->d_place=DNSResourceRecord::ADDITIONAL;
-      ret.push_back(*k);
+  if(!addit.empty()) {
+    sort(addit.begin(), addit.end());
+    addit.erase(unique(addit.begin(), addit.end(), uniqueComp), addit.end());
+    for(vector<DNSResourceRecord>::iterator k=addit.begin();k!=addit.end();++k) {
+      if(k->qtype.getCode()==QType::A || k->qtype.getCode()==QType::AAAA) {
+       k->d_place=DNSResourceRecord::ADDITIONAL;
+       ret.push_back(*k);
+      }
     }
   }
   LOG<<d_prefix<<qname<<": Done with additional processing"<<endl;