Skip to content

Commit 295a73e

Browse files
mwesenjakMathewHDYT
authored andcommitted
Add a nullptr check when OTA gets cancelled within progress callback
1 parent e84241f commit 295a73e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/OTA_Handler.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@ class OTA_Handler {
254254
void Handle_Failure(OTA_Failure_Response const & failure_response, char const * error_message) {
255255
if (m_retries <= 0) {
256256
(void)m_send_fw_state_callback.Call_Callback(FW_STATE_FAILED, error_message);
257-
m_fw_callback->Call_Callback(false);
257+
if (m_fw_callback != nullptr) {
258+
m_fw_callback->Call_Callback(false);
259+
}
258260
(void)m_finish_callback.Call_Callback();
259261
return;
260262
}
@@ -272,7 +274,9 @@ class OTA_Handler {
272274
break;
273275
case OTA_Failure_Response::RETRY_NOTHING:
274276
(void)m_send_fw_state_callback.Call_Callback(FW_STATE_FAILED, error_message);
275-
m_fw_callback->Call_Callback(false);
277+
if (m_fw_callback != nullptr) {
278+
m_fw_callback->Call_Callback(false);
279+
}
276280
(void)m_finish_callback.Call_Callback();
277281
break;
278282
default:

0 commit comments

Comments
 (0)