From 8a0d98967f1f30047c44c2245c97af39f6fb4dff Mon Sep 17 00:00:00 2001 From: Siddharth Purohit Date: Wed, 19 Aug 2020 17:55:37 +0530 Subject: [PATCH] AP_CANManager: panic if can manager is used before allocation --- libraries/AP_CANManager/AP_CANManager.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/AP_CANManager/AP_CANManager.h b/libraries/AP_CANManager/AP_CANManager.h index 0cc569cef8..cb4dfba37b 100644 --- a/libraries/AP_CANManager/AP_CANManager.h +++ b/libraries/AP_CANManager/AP_CANManager.h @@ -36,6 +36,9 @@ public: static AP_CANManager* get_singleton() { + if (_singleton == nullptr) { + AP_HAL::panic("CANManager used before allocation."); + } return _singleton; }