diff --git a/proposals.go b/proposals.go index ccae820..3864a0a 100644 --- a/proposals.go +++ b/proposals.go @@ -2,6 +2,7 @@ package main import ( "encoding/json" + "fmt" "io" "net/http" ) @@ -64,5 +65,8 @@ func getLatestProposal(cosmosEndpoint string) (*Proposal, error) { if err != nil { return nil, err } + if len(proposalsData.Proposals) == 0 { + return nil, fmt.Errorf("no proposals found") + } return &proposalsData.Proposals[0], nil }