From fb071641aea6ec6aecf6939248197f08aff97047 Mon Sep 17 00:00:00 2001 From: Jimi Date: Wed, 24 Aug 2022 21:36:52 -0600 Subject: [PATCH 1/2] Fix to crash --- components/liveTv/schedule.brs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/components/liveTv/schedule.brs b/components/liveTv/schedule.brs index b3b1fc63..49aab945 100644 --- a/components/liveTv/schedule.brs +++ b/components/liveTv/schedule.brs @@ -80,6 +80,11 @@ end sub ' When LoadScheduleTask completes (initial or more data) and we have a schedule to display sub onScheduleLoaded() + ' make sure we actually have a schedule (i.e. filter by favorites, but no channels have been favorited) + if m.scheduleGrid.content.GetChildCount() <= 0 + return + end if + for each item in m.LoadScheduleTask.schedule channel = m.scheduleGrid.content.GetChild(m.channelIndex[item.ChannelId]) @@ -101,12 +106,16 @@ end sub sub onProgramFocused() m.top.watchChannel = invalid - channel = m.scheduleGrid.content.GetChild(m.scheduleGrid.programFocusedDetails.focusChannelIndex) + if m.scheduleGrid.content.getChildCount() <= 0 + channel = invalid + else + channel = m.scheduleGrid.content.GetChild(m.scheduleGrid.programFocusedDetails.focusChannelIndex) + end if m.detailsPane.channel = channel m.top.focusedChannel = channel ' Exit if Channels not yet loaded - if channel.getChildCount() = 0 + if channel = invalid or channel.getChildCount() = 0 m.detailsPane.programDetails = invalid return end if From 1e712614e67ab14689ffe157972ce21e04aff108 Mon Sep 17 00:00:00 2001 From: Jimi Date: Wed, 24 Aug 2022 21:42:09 -0600 Subject: [PATCH 2/2] Code comments --- components/liveTv/schedule.brs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/liveTv/schedule.brs b/components/liveTv/schedule.brs index 49aab945..cea0cebc 100644 --- a/components/liveTv/schedule.brs +++ b/components/liveTv/schedule.brs @@ -106,11 +106,14 @@ end sub sub onProgramFocused() m.top.watchChannel = invalid + + ' Make sure we have channels (i.e. filter set to favorite yet there are none) if m.scheduleGrid.content.getChildCount() <= 0 channel = invalid else channel = m.scheduleGrid.content.GetChild(m.scheduleGrid.programFocusedDetails.focusChannelIndex) end if + m.detailsPane.channel = channel m.top.focusedChannel = channel