diff --git a/scryfall.go b/scryfall.go index 7c12cab..91d1a9f 100644 --- a/scryfall.go +++ b/scryfall.go @@ -66,6 +66,10 @@ func scryfallSearch(query string, offset int) (results CardSearchResults, err er defer response.Body.Close() err = json.NewDecoder(response.Body).Decode(&results) - results.Data = results.Data[cardoffset:] + maxoffset := cardoffset + 50 + if maxoffset > len(results.Data) { + maxoffset = len(results.Data) + } + results.Data = results.Data[cardoffset:maxoffset] return }