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 home page crash #1870

Merged
merged 1 commit into from
Jul 28, 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
22 changes: 19 additions & 3 deletions components/home/HomeItem.bs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import "pkg:/source/roku_modules/log/LogMixin.brs"

sub init()
m.log = log.Logger("HomeItem")
m.itemText = m.top.findNode("itemText")
m.itemPoster = m.top.findNode("itemPoster")
initItemText()
initItemPoster()
m.itemProgress = m.top.findNode("progress")
m.itemProgressBackground = m.top.findNode("progressBackground")
m.itemIcon = m.top.findNode("itemIcon")
m.itemTextExtra = m.top.findNode("itemTextExtra")
initItemTextExtra()
m.itemPoster.observeField("loadStatus", "onPosterLoadStatusChanged")
m.unplayedCount = m.top.findNode("unplayedCount")
m.unplayedEpisodeCount = m.top.findNode("unplayedEpisodeCount")
Expand All @@ -34,6 +34,17 @@ sub init()
m.backdrop.color = backdropColor
end sub

sub initItemText()
m.itemText = m.top.findNode("itemText")
end sub

sub initItemPoster()
m.itemPoster = m.top.findNode("itemPoster")
end sub

sub initItemTextExtra()
m.itemTextExtra = m.top.findNode("itemTextExtra")
end sub

sub itemContentChanged()
if isValid(m.unplayedCount) then m.unplayedCount.visible = false
Expand All @@ -43,6 +54,11 @@ sub itemContentChanged()

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

' validate to prevent crash
if not isValid(m.itemPoster) then initItemPoster()
if not isValid(m.itemText) then initItemText()
if not isValid(m.itemTextExtra) then initItemTextExtra()

m.itemPoster.width = itemData.imageWidth
m.itemText.maxWidth = itemData.imageWidth
m.itemTextExtra.width = itemData.imageWidth
Expand Down
Loading