From 679d310c5edbd762cd59443f7ae3645afeed1d60 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 2 Apr 2019 21:20:45 -1100 Subject: [PATCH] Fix crash on missing method --- src/cc/cclib.cpp | 4 ++-- src/cc/gamescc.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cc/cclib.cpp b/src/cc/cclib.cpp index 370b1b8e3..8552cfa1b 100644 --- a/src/cc/cclib.cpp +++ b/src/cc/cclib.cpp @@ -351,7 +351,7 @@ UniValue CClib_info(struct CCcontract_info *cp) UniValue CClib(struct CCcontract_info *cp,char *method,char *jsonstr) { UniValue result(UniValue::VOBJ); int32_t i; std::string rawtx; cJSON *params; - //printf("CClib params.(%s)\n",jsonstr!=0?jsonstr:""); +//printf("CClib params.(%s)\n",jsonstr!=0?jsonstr:""); for (i=0; ievalcode == CClib_methods[i].evalcode && strcmp(method,CClib_methods[i].method) == 0 ) @@ -369,7 +369,7 @@ UniValue CClib(struct CCcontract_info *cp,char *method,char *jsonstr) } } result.push_back(Pair("result","error")); - result.push_back(Pair("method",CClib_methods[i].method)); + result.push_back(Pair("method",method)); result.push_back(Pair("error","method not found")); return(result); } diff --git a/src/cc/gamescc.h b/src/cc/gamescc.h index 2a8be815e..b804216d7 100644 --- a/src/cc/gamescc.h +++ b/src/cc/gamescc.h @@ -110,7 +110,6 @@ if ( cp->evalcode == EVAL_GAMES ) \ return(games_settle(txfee,cp,params)); \ else \ { \ -fprintf(stderr,"invalid method (%s)\n",method); \ result.push_back(Pair("result","error")); \ result.push_back(Pair("error","invalid gamescc method")); \ return(result); \