Update GetHeight() for empty checkpoint data

When checkpoint map is empty, litecoin throws a segmentation fault. This commit fixes it
pull/858/head
Çağrı 2 years ago committed by GitHub
parent 4ae03b3f04
commit 0dc87f53b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 */;
}

Loading…
Cancel
Save