From 2bf46f59cee1aaa7b8296741f814341906b953c6 Mon Sep 17 00:00:00 2001 From: Yaya-Cout Date: Mon, 16 Oct 2023 19:35:31 +0200 Subject: [PATCH] =?UTF-8?q?[apps=5Fcontainer]=20Avoid=20crashing=20on=20?= =?UTF-8?q?=C3=9710^=20on=20N0100?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/apps_container_storage.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/apps_container_storage.cpp b/apps/apps_container_storage.cpp index 25953f269..6a945af11 100644 --- a/apps/apps_container_storage.cpp +++ b/apps/apps_container_storage.cpp @@ -34,6 +34,11 @@ App::Snapshot * AppsContainerStorage::appSnapshotAtIndex(int index) { }; assert(sizeof(snapshots)/sizeof(snapshots[0]) == k_numberOfCommonApps); assert(index >= 0 && index < k_numberOfCommonApps); + // To avoid crashes, we return the home app snapshot if the index is out of + // bounds. (no crash in release mode, but an assert in debug mode) + if (index >= k_numberOfCommonApps) { + return snapshots[0]; + } return snapshots[index]; }