From 4d5f88e301c4ffb51938d3cb444e427f07d0fe1e Mon Sep 17 00:00:00 2001 From: Denis Ryabov Date: Sun, 14 Mar 2021 18:29:25 +0300 Subject: [PATCH] fix segmentation fault --- db.h | 2 +- main.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/db.h b/db.h index e3050f0..e7810a3 100644 --- a/db.h +++ b/db.h @@ -232,7 +232,7 @@ public: stats.nTracked = ourId.size(); stats.nGood = goodId.size(); stats.nNew = unkId.size(); - stats.nAge = time(NULL) - idToInfo[ourId[0]].ourLastTry; + stats.nAge = ourId.size() > 0 ? time(NULL) - idToInfo[ourId[0]].ourLastTry : 0; } } diff --git a/main.cpp b/main.cpp index d6cc3b3..f2535fe 100644 --- a/main.cpp +++ b/main.cpp @@ -341,6 +341,7 @@ vector dnsThread; extern "C" void* ThreadDNS(void* arg) { CDnsThread *thread = (CDnsThread*)arg; thread->run(); + return NULL; } int StatCompare(const CAddrReport& a, const CAddrReport& b) {