From 6a2eefba9c9676b987a27cfe3b01595ed39d8788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Teppo=20J=C3=A4rvelin?= Date: Thu, 19 Apr 2018 12:46:22 +0300 Subject: [PATCH] Cellular: fixed null pointer bug. Null pointer could have been called after stop() in cellular state machine. --- .../cellular/easy_cellular/CellularConnectionFSM.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/features/cellular/easy_cellular/CellularConnectionFSM.cpp b/features/cellular/easy_cellular/CellularConnectionFSM.cpp index 35c1eace32..116f4b4c49 100644 --- a/features/cellular/easy_cellular/CellularConnectionFSM.cpp +++ b/features/cellular/easy_cellular/CellularConnectionFSM.cpp @@ -76,14 +76,7 @@ CellularConnectionFSM::~CellularConnectionFSM() void CellularConnectionFSM::stop() { tr_info("CellularConnectionUtil::stop"); - if (_cellularDevice) { - _cellularDevice->close_power(); - _cellularDevice->close_network(); - _cellularDevice->close_sim(); - _power = NULL; - _network = NULL; - _sim = NULL; - } + if (_queue_thread) { _queue_thread->terminate(); delete _queue_thread; @@ -162,7 +155,7 @@ bool CellularConnectionFSM::open_sim() nsapi_error_t err = _sim->set_pin(_sim_pin); if (err) { tr_error("SIM pin set failed with: %d, bailing out...", err); - } + } } else { tr_warn("PIN required but No SIM pin provided."); }