From 0a7a6c65e2cf906e5253fc7258a3e4ad2c37db1f Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Tue, 2 Jan 2024 10:57:14 -0500 Subject: [PATCH] Bug fix --- CHANGELOG.md | 1 + playlet-lib/src/components/VideoFeed/VideoRowList.bs | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5a587eb..0eda99c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - A rare bug that causes the app to crash when displaying video cells +- A rare bug where a long press can cause a crash ### Removed diff --git a/playlet-lib/src/components/VideoFeed/VideoRowList.bs b/playlet-lib/src/components/VideoFeed/VideoRowList.bs index 69e77e00..2170afc7 100644 --- a/playlet-lib/src/components/VideoFeed/VideoRowList.bs +++ b/playlet-lib/src/components/VideoFeed/VideoRowList.bs @@ -123,16 +123,21 @@ function OnRowItemLongPressed(index as object) as void return end if + if not IsArray(index) or index.count() <> 2 + LogWarn("Invalid index:", index) + return + end if + rowIndex = index[0] rowItemIndex = index[1] - if rowIndex < 0 or rowIndex >= content.GetChildCount() + if not IsInt(rowIndex) or rowIndex < 0 or rowIndex >= content.GetChildCount() LogWarn("Invalid row index:", rowIndex) return end if row = content.GetChild(rowIndex) - if rowItemIndex < 0 or rowItemIndex >= row.GetChildCount() + if not IsInt(rowItemIndex) or rowItemIndex < 0 or rowItemIndex >= row.GetChildCount() LogWarn("Invalid row item index:", rowItemIndex) return end if