From e4f5c193640f6cfe4c9ff3034170385240c748c8 Mon Sep 17 00:00:00 2001 From: Charles Ewert Date: Thu, 18 Jul 2024 08:25:06 -0400 Subject: [PATCH 1/2] prevent app crash by ensuring data is valid --- source/Main.bs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/source/Main.bs b/source/Main.bs index 19168e464..2f2fda6b7 100644 --- a/source/Main.bs +++ b/source/Main.bs @@ -237,15 +237,17 @@ sub Main (args as dynamic) as void currentScene = m.global.sceneManager.callFunc("getActiveScene") - ' Refresh movie detail data - currentScene.itemContent.json = api.users.GetItem(m.global.session.user.id, currentScene.itemContent.id) - movieMetaData = ItemMetaData(currentScene.itemContent.id) + if isValid(currentScene) and isValid(currentScene.itemContent) and isValid(currentScene.itemContent.id) and isValid(currentScene.itemContent.json) + ' Refresh movie detail data + currentScene.itemContent.json = api.users.GetItem(m.global.session.user.id, currentScene.itemContent.id) + movieMetaData = ItemMetaData(currentScene.itemContent.id) - ' Redraw movie poster - currentScene.newPosterImageURI = movieMetaData.posterURL + ' Redraw movie poster + currentScene.newPosterImageURI = movieMetaData.posterURL - ' Set updated starting point for the queue item - m.global.queueManager.callFunc("setTopStartingPoint", currentScene.itemContent.json.UserData.PlaybackPositionTicks) + ' Set updated starting point for the queue item + m.global.queueManager.callFunc("setTopStartingPoint", currentScene.itemContent.json.UserData.PlaybackPositionTicks) + end if stopLoadingSpinner() else if isNodeEvent(msg, "selectedItem") From 4ca1bfb56708c37a234eda85ac09df2af3f37b6b Mon Sep 17 00:00:00 2001 From: Charles Ewert Date: Thu, 18 Jul 2024 10:41:24 -0400 Subject: [PATCH 2/2] address reviewer feedback --- source/Main.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Main.bs b/source/Main.bs index 2f2fda6b7..90e4c55ed 100644 --- a/source/Main.bs +++ b/source/Main.bs @@ -237,7 +237,7 @@ sub Main (args as dynamic) as void currentScene = m.global.sceneManager.callFunc("getActiveScene") - if isValid(currentScene) and isValid(currentScene.itemContent) and isValid(currentScene.itemContent.id) and isValid(currentScene.itemContent.json) + if isValid(currentScene) and isValid(currentScene.itemContent) and isValid(currentScene.itemContent.id) ' Refresh movie detail data currentScene.itemContent.json = api.users.GetItem(m.global.session.user.id, currentScene.itemContent.id) movieMetaData = ItemMetaData(currentScene.itemContent.id)