From 534c5ee516354074a029643cb48b3f4534cf5f4e Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 28 Jan 2019 22:38:06 -1100 Subject: [PATCH] Err --- src/wallet/rpcwallet.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index b799c6672..2d4ba25d7 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5326,21 +5326,22 @@ UniValue channelsaddress(const UniValue& params, bool fHelp) UniValue cclibaddress(const UniValue& params, bool fHelp) { - struct CCcontract_info *cp,C; std::vector pubkey; + struct CCcontract_info *cp,C; std::vector pubkey; uint8_t evalcode = EVAL_FIRSTUSER; if ( fHelp || params.size() > 2 ) throw runtime_error("cclibaddress [evalcode] [pubkey]\n"); if ( ensure_CCrequirements() < 0 ) throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n"); - cp = CCinit(&C,EVAL_FIRSTUSER); if ( params.size() >= 1 ) { evalcode = atoi(params[0].get_str().c_str()); if ( evalcode < EVAL_FIRSTUSER || evalcode > EVAL_LASTUSER ) throw runtime_error("evalcode not between EVAL_FIRSTUSER and EVAL_LASTUSER\n"); - cp = CCinit(&C,evalcode); if ( params.size() == 2 ) pubkey = ParseHex(params[1].get_str().c_str()); } + cp = CCinit(&C,evalcode); + if ( cp == 0 ) + throw runtime_error("error creating *cp\n"); return(CCaddress(cp,(char *)"CClib",pubkey)); }