Skip to content

Commit

Permalink
set default backdrop color to prevent crash
Browse files Browse the repository at this point in the history
  • Loading branch information
cewert committed Jan 13, 2024
1 parent 5aa26f3 commit 7527d40
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions components/home/HomeItem.bs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,17 @@ sub init()
m.showProgressBarField = m.top.findNode("showProgressBarField")

' Randomize the background colors
backdropColor = "#00a4db" ' set default in case global var is invalid
localGlobal = m.global

if isValid(localGlobal) and isValid(localGlobal.constants) and isValid(localGlobal.constants.poster_bg_pallet)
posterBackgrounds = localGlobal.constants.poster_bg_pallet
backdropColor = posterBackgrounds[rnd(posterBackgrounds.count()) - 1]
end if

' update the backdrop node
m.backdrop = m.top.findNode("backdrop")
posterBackgrounds = m.global.constants.poster_bg_pallet
m.backdrop.color = posterBackgrounds[rnd(posterBackgrounds.count()) - 1]
m.backdrop.color = backdropColor
end sub


Expand Down

0 comments on commit 7527d40

Please sign in to comment.