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 ExtrasItem crash #1872

Merged
merged 2 commits into from
Aug 2, 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
21 changes: 20 additions & 1 deletion components/extras/ExtrasItem.bs
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
import "pkg:/source/utils/misc.bs"

sub init()
initPosterImg()
initName()
initRole()
end sub

sub initPosterImg()
m.posterImg = m.top.findNode("posterImg")
end sub

sub initName()
m.name = m.top.findNode("pLabel")
end sub

sub initRole()
m.role = m.top.findNode("subTitle")
end sub

sub showContent()
if m.top.itemContent <> invalid
' validate nodes to prevent crash
if not isValid(m.posterImg) then initPosterImg()
if not isValid(m.name) then initName()
if not isValid(m.role) then initRole()

if isValid(m.top.itemContent)
cont = m.top.itemContent
m.name.text = cont.labelText
m.name.maxWidth = cont.imageWidth
Expand Down
Loading