Skip to content

Commit

Permalink
Fix input validation for GalaxyInfos
Browse files Browse the repository at this point in the history
  • Loading branch information
alaingilbert committed Jun 16, 2020
1 parent e0672fd commit 9fc6850
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ogame.go
Original file line number Diff line number Diff line change
Expand Up @@ -2798,11 +2798,11 @@ func (b *OGame) getAttacks(opts ...Option) (out []AttackEvent, err error) {

func (b *OGame) galaxyInfos(galaxy, system int64, options ...Option) (SystemInfos, error) {
var res SystemInfos
if galaxy < 0 || galaxy > b.server.Settings.UniverseSize {
return res, fmt.Errorf("galaxy must be within [0, %d]", b.server.Settings.UniverseSize)
if galaxy < 1 || galaxy > b.server.Settings.UniverseSize {
return res, fmt.Errorf("galaxy must be within [1, %d]", b.server.Settings.UniverseSize)
}
if system < 0 || system > b.serverData.Systems {
return res, errors.New("system must be within [0, " + strconv.FormatInt(b.serverData.Systems, 10) + "]")
if system < 1 || system > b.serverData.Systems {
return res, errors.New("system must be within [1, " + strconv.FormatInt(b.serverData.Systems, 10) + "]")
}
payload := url.Values{
"galaxy": {strconv.FormatInt(galaxy, 10)},
Expand Down

0 comments on commit 9fc6850

Please sign in to comment.