From 45a8e2db9f78c12d5af41ea4fad8b8a0dee83b64 Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Wed, 14 Apr 2021 13:44:02 -0400 Subject: Check for invalid app_id when app is init --- pico-watch.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'pico-watch.cpp') diff --git a/pico-watch.cpp b/pico-watch.cpp index e04be23..60537a8 100644 --- a/pico-watch.cpp +++ b/pico-watch.cpp @@ -31,6 +31,11 @@ int app_init(int app_id) { app_api.display_fill(0,1); // Clear OLED app_api.performance_render_interval_set(500); // Reset interval + if (app_id > NUMBER_OF_APPS-1 or app_id < 0) { + printf("Tried to init app %d", app_id); + return app_init(0); + } + if (!APPS_IS_INIT[app_id]) { int status = (*APPS_FUNC_INIT[app_id])(&app_api); -- cgit v1.2.3-54-g00ecf