diff --git a/configure.ac b/configure.ac index 18eca5728..951d50c93 100644 --- a/configure.ac +++ b/configure.ac @@ -280,7 +280,7 @@ AX_CHECK_COMPILE_FLAG([-maes],[[AES_CFLAGS="-maes"]],[[AES_CFLAGS="no"]],[[$CXXF if test x$AES_CFLAGS = xno; then AC_MSG_ERROR("Compiler does not support -maes which is required by Cryptonight.") fi -CFLAGS="$CXXFLAGS $AES_CFLAGS" +CFLAGS="$CFLAGS $AES_CFLAGS" TEMP_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS $SSE42_CXXFLAGS" diff --git a/src/primitives/block.cpp b/src/primitives/block.cpp index 260d5fe3b..cd0fc7e0e 100644 --- a/src/primitives/block.cpp +++ b/src/primitives/block.cpp @@ -20,13 +20,16 @@ extern "C" void cn_fast_hash(const void *data, size_t length, char *hash); static void cn_get_block_hash_by_height(uint64_t seed_height, char cnHash[32]) { CBlockIndex* pblockindex = chainActive[seed_height]; - if (pblockindex == NULL) { + if (pblockindex == nullptr) { // This will happen during initial block downloading, or when we // are out of sync by more than at least SEEDHASH_EPOCH_BLOCKS blocks. LOCK(cs_main); - pblockindex = mapBlockSeedHeight.find(seed_height)->second; + std::map::iterator iter = mapBlockSeedHeight.find(seed_height); + if (iter != mapBlockSeedHeight.end()) { + pblockindex = iter->second; + } } - if (pblockindex == NULL) { + if (pblockindex == nullptr) { return; } uint256 blockHash = pblockindex->GetBlockHash();