Accommodate for empty RD accounts

This commit is contained in:
Ben Sarmiento
2024-01-08 13:01:21 +01:00
parent b1116dfcca
commit 122eea2374
4 changed files with 37 additions and 31 deletions

View File

@@ -95,6 +95,10 @@ func (rd *RealDebrid) GetTorrents(customLimit int, active bool) ([]Torrent, int,
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusNoContent {
return allTorrents, 0, nil
}
// if status code is not 2xx, return erro
var torrents []Torrent
@@ -340,6 +344,10 @@ func (rd *RealDebrid) GetDownloads(page, offset int) ([]Download, int, error) {
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusNoContent {
return allDownloads, 0, nil
}
// if status code is not 2xx, return erro
var downloads []Download