aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConfuSomu2021-02-27 15:05:12 -0500
committerConfuSomu2021-02-27 15:05:12 -0500
commit9ccb4e036c2de27126624498e2441faea3004d1f (patch)
tree251ba050e84a800d8e252d9b822d2b2e9dbb44fb
parent2a0571ba87183023b1073af1badb5fb91da763cf (diff)
downloadpico-watch-9ccb4e036c2de27126624498e2441faea3004d1f.tar
pico-watch-9ccb4e036c2de27126624498e2441faea3004d1f.tar.gz
pico-watch-9ccb4e036c2de27126624498e2441faea3004d1f.zip
Init selected_app in home_menu to a default value
When the value references an out of bounds memory address, line 47 in same file may cause hardfault/segmentation fault.
-rw-r--r--apps/home_menu.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/home_menu.cpp b/apps/home_menu.cpp
index 19458e6..c261611 100644
--- a/apps/home_menu.cpp
+++ b/apps/home_menu.cpp
@@ -81,8 +81,8 @@ namespace app_home_menu {
// Initlisation of the app.
int init(Api *app_api) {
- pressed_button = new char; *pressed_button = '*';
- selected_app = new int;
+ pressed_button = new char; *pressed_button = '*';
+ selected_app = new int; *selected_app = 0; // Make sure to init the values to something known!
return 0; // return 1 when function not implemented
}