From 075c379444a2ac2486384995c653398fd5a4e49d Mon Sep 17 00:00:00 2001 From: ion098 <146852218+ion098@users.noreply.github.com> Date: Thu, 10 Oct 2024 19:10:37 +0000 Subject: [PATCH] fix: :bug: Fix usage of unintialized fields This should fix the data aborts that would occur when running the code. Previously the code would access fields in Gamepad that were uninitialized, leading to the code crashing. --- include/gamepad/gamepad.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/gamepad/gamepad.hpp b/include/gamepad/gamepad.hpp index 2440f18..21e7a80 100644 --- a/include/gamepad/gamepad.hpp +++ b/include/gamepad/gamepad.hpp @@ -119,16 +119,16 @@ class Gamepad { void updateScreens(); - std::shared_ptr defaultScreen; - std::vector> screens; - ScreenBuffer currentScreen; - ScreenBuffer nextBuffer; + std::shared_ptr defaultScreen = std::make_shared(); + std::vector> screens{}; + ScreenBuffer currentScreen{}; + ScreenBuffer nextBuffer{}; pros::Controller controller; uint8_t last_printed_line = 0; uint last_print_time = 0; uint last_update_time = 0; - pros::Mutex mut; + pros::Mutex mut{}; }; inline Gamepad Gamepad::master {pros::E_CONTROLLER_MASTER};