From 8163227225a0e525b7da821de1e5602015d97a41 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Tue, 8 Oct 2013 19:25:33 -0400 Subject: [PATCH] Correctly parse account name for getnewaddress --- cmdmgr.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cmdmgr.go b/cmdmgr.go index 75f03dc..e55b7c9 100644 --- a/cmdmgr.go +++ b/cmdmgr.go @@ -310,16 +310,20 @@ func GetBalance(reply chan []byte, msg *btcjson.Message) { // the requested wallet does not exist, a JSON error will be returned to // the client. func GetNewAddress(reply chan []byte, msg *btcjson.Message) { + e := InvalidParams params, ok := msg.Params.([]interface{}) if !ok { - log.Error("GetNewAddress: Cannot parse parameters.") + ReplyError(reply, msg.Id, &e) return } var wname string - if len(params) == 0 || params[0].(string) == "" { - wname = "" - } else { - wname = "params[0].(string)" + if len(params) > 0 { + var ok bool + if wname, ok = params[0].(string); !ok { + e.Message = "account is not a string" + ReplyError(reply, msg.Id, &e) + return + } } wallets.RLock()