diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2024-05-02 21:52:46 +0100 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2024-05-02 23:10:05 +0100 |
commit | bd2de7ac591d7704b79304089ad1fb57e085da8b (patch) | |
tree | 305c135841cfa774135ae5628d9816dd8a387c03 /src | |
parent | 81174d8a9b8060b35341d88d3b54c08d9f2bb079 (diff) | |
download | bitcoin-bd2de7ac591d7704b79304089ad1fb57e085da8b.tar.xz |
refactor, test: Always initialize pointer
This change fixes MSVC warning C4703.
See: https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4703
All `DisableSpecificWarnings` dropped from `test_bitcoin.vcxproj` as all
remained are inherited from `common.init.vcxproj`.
Diffstat (limited to 'src')
-rw-r--r-- | src/test/validation_chainstate_tests.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/test/validation_chainstate_tests.cpp b/src/test/validation_chainstate_tests.cpp index fe2d2ba592..1c02066047 100644 --- a/src/test/validation_chainstate_tests.cpp +++ b/src/test/validation_chainstate_tests.cpp @@ -12,6 +12,7 @@ #include <test/util/random.h> #include <test/util/setup_common.h> #include <uint256.h> +#include <util/check.h> #include <validation.h> #include <vector> @@ -102,14 +103,14 @@ BOOST_FIXTURE_TEST_CASE(chainstate_update_tip, TestChain100Setup) BOOST_CHECK_EQUAL(chainman.GetAll().size(), 2); - Chainstate& background_cs{*[&] { + Chainstate& background_cs{*Assert([&]() -> Chainstate* { for (Chainstate* cs : chainman.GetAll()) { if (cs != &chainman.ActiveChainstate()) { return cs; } } - assert(false); - }()}; + return nullptr; + }())}; // Append the first block to the background chain. BlockValidationState state; |