Check for 0 shas before dereferencing list

This commit is contained in:
Owain G. Ainsworth 2013-11-07 22:26:43 +00:00
parent ced24946a4
commit d81a2c9067

View file

@ -670,7 +670,7 @@ func handleGetRawTransaction(s *rpcServer, cmd btcjson.Cmd, walletNotification c
// this point.
txSha, _ := btcwire.NewShaHashFromStr(c.Txid)
txList, err := s.server.db.FetchTxBySha(txSha)
if err != nil {
if err != nil || len(txList) == 0 {
log.Errorf("RPCS: Error fetching tx: %v", err)
return nil, btcjson.ErrNoTxInfo
}