diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-12-19 03:25:55 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-12-19 03:25:55 +0800 |
commit | 4811409e99e87cd8862a9813422d61fc0f752d18 (patch) | |
tree | 60231ca682a4bafdeca506c32171d57eb15cc910 | |
parent | fd69d2b7a87d9f00854e7d8939a6b3ab53cf8c9b (diff) | |
parent | 3c9a2c752fcc1d85d1e026ac498b2e092725db61 (diff) | |
download | dexon-4811409e99e87cd8862a9813422d61fc0f752d18.tar.gz dexon-4811409e99e87cd8862a9813422d61fc0f752d18.tar.zst dexon-4811409e99e87cd8862a9813422d61fc0f752d18.zip |
Merge pull request #2084 from bas-vk/rpcnilptr
console crash on nil ptr
-rw-r--r-- | cmd/geth/js.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/cmd/geth/js.go b/cmd/geth/js.go index 56b7a8b00..9329eaa0e 100644 --- a/cmd/geth/js.go +++ b/cmd/geth/js.go @@ -341,11 +341,12 @@ func (js *jsre) apiBindings(f xeth.Frontend) error { // Override the unlockAccount and newAccount methods on the personal object since these require user interaction. // Assign the jeth.unlockAccount and jeth.newAccount in the jsre the original web3 callbacks. These will be called // by the jeth.* methods after they got the password from the user and send the original web3 request to the backend. - persObj := p.Object() - js.re.Run(`jeth.unlockAccount = personal.unlockAccount;`) - persObj.Set("unlockAccount", jeth.UnlockAccount) - js.re.Run(`jeth.newAccount = personal.newAccount;`) - persObj.Set("newAccount", jeth.NewAccount) + if persObj := p.Object(); persObj != nil { // make sure the personal api is enabled over the interface + js.re.Run(`jeth.unlockAccount = personal.unlockAccount;`) + persObj.Set("unlockAccount", jeth.UnlockAccount) + js.re.Run(`jeth.newAccount = personal.newAccount;`) + persObj.Set("newAccount", jeth.NewAccount) + } return nil } |