From 60fedfed8383d328a4f860b6c36a55c58553e478 Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Tue, 29 Oct 2024 09:14:23 +0800 Subject: [PATCH] fix staticcheck SA5011: possible nil pointer dereference --- cmd/puppeth/wizard_netstats.go | 3 ++- mobile/ethereum.go | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/puppeth/wizard_netstats.go b/cmd/puppeth/wizard_netstats.go index b8bdd19fb0..37bdb0e812 100644 --- a/cmd/puppeth/wizard_netstats.go +++ b/cmd/puppeth/wizard_netstats.go @@ -82,7 +82,6 @@ func (w *wizard) gatherStats(server string, pubkey []byte, client *sshClient) *s logger.Info("Starting remote server health-check") stat := &serverStat{ - address: client.address, services: make(map[string]map[string]string), } if client == nil { @@ -94,6 +93,8 @@ func (w *wizard) gatherStats(server string, pubkey []byte, client *sshClient) *s } client = conn } + stat.address = client.address + // Client connected one way or another, run health-checks logger.Debug("Checking for nginx availability") if infos, err := checkNginx(client, w.network); err != nil { diff --git a/mobile/ethereum.go b/mobile/ethereum.go index f7904b7c32..ac21afdd6b 100644 --- a/mobile/ethereum.go +++ b/mobile/ethereum.go @@ -64,11 +64,13 @@ func (msg *CallMsg) SetGas(gas int64) { msg.msg.Gas = uint64(gas) } func (msg *CallMsg) SetGasPrice(price *BigInt) { msg.msg.GasPrice = price.bigint } func (msg *CallMsg) SetValue(value *BigInt) { msg.msg.Value = value.bigint } func (msg *CallMsg) SetData(data []byte) { msg.msg.Data = common.CopyBytes(data) } + func (msg *CallMsg) SetTo(address *Address) { if address == nil { msg.msg.To = nil + } else { + msg.msg.To = &address.address } - msg.msg.To = &address.address } // SyncProgress gives progress indications when the node is synchronising with