Skip to content

Commit

Permalink
Merge pull request #1872 from cewert/fix-extrasitem-crash
Browse files Browse the repository at this point in the history
  • Loading branch information
cewert authored Aug 2, 2024
2 parents e2c390a + 51f3c07 commit 49d8193
Showing 1 changed file with 20 additions and 1 deletion.
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

0 comments on commit 49d8193

Please sign in to comment.