fix(rpc): guard z_validateaddress against null pwalletMain under -disablewallet

#11 (HIGH) z_validateaddress locked LOCK2(cs_main, pwalletMain->cs_wallet) with
no availability guard; under -disablewallet pwalletMain is NULL, so the member
deref SIGSEGVs the daemon (execute() only catches std::exception). Use the
null-safe LOCK2 idiom already used by sibling RPCs so validation still works
without a wallet.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-14 11:21:28 -05:00
parent 11704e6023
commit a520441e3a

View File

@@ -560,7 +560,7 @@ UniValue z_validateaddress(const UniValue& params, bool fHelp, const CPubKey& my
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
LOCK2(cs_main, pwalletMain->cs_wallet); LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL);
#else #else
LOCK(cs_main); LOCK(cs_main);
#endif #endif