From fba290fed6a5e3cfd2893b6d9e5a4afc0d80c1b3 Mon Sep 17 00:00:00 2001 From: Charles Ewert Date: Wed, 31 Jul 2024 08:28:25 -0400 Subject: [PATCH] validate node ref to prevent crash --- components/home/HomeItem.bs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/home/HomeItem.bs b/components/home/HomeItem.bs index c5546d5ab..797e253c1 100644 --- a/components/home/HomeItem.bs +++ b/components/home/HomeItem.bs @@ -30,7 +30,7 @@ sub init() end if ' update the backdrop node - m.backdrop = m.top.findNode("backdrop") + initBackdrop() m.backdrop.color = backdropColor end sub @@ -46,6 +46,10 @@ sub initItemTextExtra() m.itemTextExtra = m.top.findNode("itemTextExtra") end sub +sub initBackdrop() + m.backdrop = m.top.findNode("backdrop") +end sub + sub itemContentChanged() if isValid(m.unplayedCount) then m.unplayedCount.visible = false itemData = m.top.itemContent @@ -58,6 +62,7 @@ sub itemContentChanged() if not isValid(m.itemPoster) then initItemPoster() if not isValid(m.itemText) then initItemText() if not isValid(m.itemTextExtra) then initItemTextExtra() + if not isValid(m.backdrop) then initBackdrop() m.itemPoster.width = itemData.imageWidth m.itemText.maxWidth = itemData.imageWidth