validate data from api to prevent crash on episode list

This commit is contained in:
Charles Ewert 2024-10-01 11:24:49 -04:00
parent d7c99f508f
commit e2080fb25a

View File

@ -224,8 +224,12 @@ sub Main (args as dynamic) as void
' Find the object in the scene's data and update its json data
for i = 0 to currentScene.objects.Items.count() - 1
if LCase(currentScene.objects.Items[i].id) = LCase(currentEpisode.id)
currentScene.objects.Items[i].json = api.users.GetItem(m.global.session.user.id, currentEpisode.id)
m.global.queueManager.callFunc("setTopStartingPoint", currentScene.objects.Items[i].json.UserData.PlaybackPositionTicks)
data = api.users.GetItem(m.global.session.user.id, currentEpisode.id)
if isValid(data)
currentScene.objects.Items[i].json = data
m.global.queueManager.callFunc("setTopStartingPoint", data.UserData.PlaybackPositionTicks)
end if
exit for
end if
end for