validate tv seasons data before using - fixes crash on line 408

This commit is contained in:
Charles Ewert 2023-04-19 15:19:45 -04:00
parent 9e3e15846b
commit b91b2c582d

View File

@ -397,11 +397,13 @@ function BackdropImage(id as string)
end function
' Seasons for a TV Show
function TVSeasons(id as string)
function TVSeasons(id as string) as dynamic
url = Substitute("Shows/{0}/Seasons", id)
resp = APIRequest(url, { "UserId": get_setting("active_user") })
data = getJson(resp)
' validate data
if data = invalid or data = "" then return invalid
results = []
for each item in data.Items
imgParams = { "AddPlayedIndicator": item.UserData.Played }