Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bgklika/ceeaa6fa35c1bdfa31a9e67e220b9c21 to your computer and use it in GitHub Desktop.
Save bgklika/ceeaa6fa35c1bdfa31a9e67e220b9c21 to your computer and use it in GitHub Desktop.
diff --git a/src/amazon-freertos/libraries/freertos_plus/aws/ota/src/mqtt/aws_iot_ota_mqtt.c b/src/amazon-freertos/libraries/freertos_plus/aws/ota/src/mqtt/aws_iot_ota_mqtt.c
index 634f21885..c185e6755 100644
--- a/src/amazon-freertos/libraries/freertos_plus/aws/ota/src/mqtt/aws_iot_ota_mqtt.c
+++ b/src/amazon-freertos/libraries/freertos_plus/aws/ota/src/mqtt/aws_iot_ota_mqtt.c
@@ -391,6 +391,12 @@ static OTA_Err_t prvPublishStatusMessage( OTA_AgentContext_t * pxAgentCtx,
IotMqttError_t eResult;
char pcTopicBuffer[ OTA_MAX_TOPIC_LEN ];
+ if( NULL == pxAgentCtx || NULL == pxAgentCtx->pcThingName || NULL == pxAgentCtx->pcOTA_Singleton_ActiveJobName )
+ {
+ OTA_LOG_L1( "[%s] Failed: thing or job names are not available\r\n", OTA_METHOD_NAME );
+ return kOTA_Err_PublishFailed;
+ }
+
/* Try to build the dynamic job status topic . */
ulTopicLen = ( uint32_t ) snprintf( pcTopicBuffer, /*lint -e586 Intentionally using snprintf. */
sizeof( pcTopicBuffer ),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment