Fix to crash

This commit is contained in:
Jimi 2022-08-24 21:36:52 -06:00
parent b4dc073265
commit fb071641ae

View File

@ -80,6 +80,11 @@ end sub
' When LoadScheduleTask completes (initial or more data) and we have a schedule to display ' When LoadScheduleTask completes (initial or more data) and we have a schedule to display
sub onScheduleLoaded() 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 for each item in m.LoadScheduleTask.schedule
channel = m.scheduleGrid.content.GetChild(m.channelIndex[item.ChannelId]) channel = m.scheduleGrid.content.GetChild(m.channelIndex[item.ChannelId])
@ -101,12 +106,16 @@ end sub
sub onProgramFocused() sub onProgramFocused()
m.top.watchChannel = invalid 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.detailsPane.channel = channel
m.top.focusedChannel = channel m.top.focusedChannel = channel
' Exit if Channels not yet loaded ' Exit if Channels not yet loaded
if channel.getChildCount() = 0 if channel = invalid or channel.getChildCount() = 0
m.detailsPane.programDetails = invalid m.detailsPane.programDetails = invalid
return return
end if end if