call onNewBlock() iff listener registered

This commit is contained in:
woodser
2019-05-29 17:39:11 -04:00
parent 6ea3a8ba44
commit 01c26fd0ec
+6 -4
View File
@@ -51,10 +51,12 @@ namespace monero {
virtual void on_new_block(uint64_t height, const cryptonote::block& cnBlock) {
// notify listeners of block
MoneroBlock block;
block.height = height;
listener->onNewBlock(block);
// notify listener of block
if (this->listener != nullptr) {
MoneroBlock block;
block.height = height;
listener->onNewBlock(block);
}
// notify listeners of sync progress
if (syncStartHeight != nullptr && height > *syncStartHeight) {