Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash on home screen #2029

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions components/home/HomeItem.bs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,15 @@ sub itemContentChanged()
if isValid(m.unplayedCount) then m.unplayedCount.visible = false
itemData = m.top.itemContent
if itemData = invalid then return
userSettings = m.global.session.user.settings

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

' validate to prevent crash
userSettings = invalid
if isValid(m.global) and isValid(m.global.session) and isValid(m.global.session.user) and isValid(m.global.session.user.settings)
userSettings = m.global.session.user.settings
end if

' validate to prevent crash
if not isValid(m.itemPoster) then initItemPoster()
if not isValid(m.itemText) then initItemText()
Expand Down Expand Up @@ -164,17 +169,22 @@ sub itemContentChanged()
drawProgressBar(itemData)
end if

if userSettings["ui.general.episodeimagesnextup"] = "webclient"
tmpSetting = m.global.session.user.Configuration.useEpisodeImagesInNextUpAndResume
if isValid(tmpSetting) and tmpSetting
m.itemPoster.uri = itemData.thumbnailURL
else
if isValid(userSettings)
if userSettings["ui.general.episodeimagesnextup"] = "webclient"
tmpSetting = m.global.session.user.Configuration.useEpisodeImagesInNextUpAndResume
if isValid(tmpSetting) and tmpSetting
m.itemPoster.uri = itemData.thumbnailURL
else
m.itemPoster.uri = itemData.widePosterURL
end if
else if userSettings["ui.general.episodeimagesnextup"] = "show"
m.itemPoster.uri = itemData.widePosterURL
else if userSettings["ui.general.episodeimagesnextup"] = "episode"
m.itemPoster.uri = itemData.thumbnailURL
end if
else if userSettings["ui.general.episodeimagesnextup"] = "show"
else
' use show image if user settings are invalid for some reason
m.itemPoster.uri = itemData.widePosterURL
else if userSettings["ui.general.episodeimagesnextup"] = "episode"
m.itemPoster.uri = itemData.thumbnailURL
end if

' Set Series and Episode Number for Extra Text
Expand Down
Loading