From 0dc87f53b1eb65ed3b54c9ef80fe46c4c19ea026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87a=C4=9Fr=C4=B1?= Date: Tue, 6 Sep 2022 16:56:31 +0000 Subject: [PATCH] Update GetHeight() for empty checkpoint data When checkpoint map is empty, litecoin throws a segmentation fault. This commit fixes it --- src/chainparams.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/chainparams.h b/src/chainparams.h index ffeb1f30a2b58..bbb25090ad2f6 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -25,6 +25,9 @@ struct CCheckpointData { MapCheckpoints mapCheckpoints; int GetHeight() const { + if(mapCheckpoints.empty()) + return 0; + const auto& final_checkpoint = mapCheckpoints.rbegin(); return final_checkpoint->first /* height */; }