Skip to content

Commit

Permalink
Validate global before using
Browse files Browse the repository at this point in the history
  • Loading branch information
cewert committed Feb 14, 2024
1 parent fe49ea0 commit d2834c5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions components/home/HomeItem.bs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ sub itemContentChanged()
m.unplayedCount.visible = false
itemData = m.top.itemContent
if itemData = invalid then return
localGlobal = m.global

itemData.Title = itemData.name ' Temporarily required while we move from "HomeItem" to "JFContentItem"

Expand All @@ -61,11 +62,13 @@ sub itemContentChanged()
m.playedIndicator.visible = false

if LCase(itemData.type) = "series"
if m.global.session.user.settings["ui.tvshows.disableUnwatchedEpisodeCount"] = false
if isValid(itemData.json.UserData) and isValid(itemData.json.UserData.UnplayedItemCount)
if itemData.json.UserData.UnplayedItemCount > 0
m.unplayedCount.visible = true
m.unplayedEpisodeCount.text = itemData.json.UserData.UnplayedItemCount
if isValid(localGlobal) and isValid(localGlobal.session) and isValid(localGlobal.session.user) and isValid(localGlobal.session.user.settings)
if localGlobal.session.user.settings["ui.tvshows.disableUnwatchedEpisodeCount"] = false
if isValid(itemData.json.UserData) and isValid(itemData.json.UserData.UnplayedItemCount)
if itemData.json.UserData.UnplayedItemCount > 0
m.unplayedCount.visible = true
m.unplayedEpisodeCount.text = itemData.json.UserData.UnplayedItemCount
end if
end if
end if
end if
Expand Down

0 comments on commit d2834c5

Please sign in to comment.