From 85b534b23eb2c39fc97a4c5e9de6f61580bb61b1 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Wed, 30 Jan 2013 15:07:00 -0500 Subject: [PATCH] Prevent Qt crash at startup with an empty data directory --- src/qt/clientmodel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 12bd98933..084ad12a5 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -48,7 +48,10 @@ int ClientModel::getNumBlocksAtStartup() QDateTime ClientModel::getLastBlockDate() const { - return QDateTime::fromTime_t(pindexBest->GetBlockTime()); + if (pindexBest) + return QDateTime::fromTime_t(pindexBest->GetBlockTime()); + else + return QDateTime::fromTime_t(1231006505); // Genesis block's time } void ClientModel::updateTimer()