diff --git a/FreeRTOS-Plus/Demo/AWS/Mqtt_Demo_Helpers/mqtt_demo_helpers.c b/FreeRTOS-Plus/Demo/AWS/Mqtt_Demo_Helpers/mqtt_demo_helpers.c index 77520b9c54..144d180a96 100644 --- a/FreeRTOS-Plus/Demo/AWS/Mqtt_Demo_Helpers/mqtt_demo_helpers.c +++ b/FreeRTOS-Plus/Demo/AWS/Mqtt_Demo_Helpers/mqtt_demo_helpers.c @@ -809,7 +809,7 @@ BaseType_t xEstablishMqttSession( MQTTContext_t * pxMqttContext, xMqttSessionEstablished = true; } - if( xReturnStatus == pdFAIL ) + if( xReturnStatus != pdFAIL ) { /* Check if session is present and if there are any outgoing publishes * that need to resend. This is only valid if the broker is diff --git a/FreeRTOS-Plus/Demo/AWS/Mqtt_Demo_Helpers/mqtt_pkcs11_demo_helpers.c b/FreeRTOS-Plus/Demo/AWS/Mqtt_Demo_Helpers/mqtt_pkcs11_demo_helpers.c index 9458b3dabc..170e35758e 100644 --- a/FreeRTOS-Plus/Demo/AWS/Mqtt_Demo_Helpers/mqtt_pkcs11_demo_helpers.c +++ b/FreeRTOS-Plus/Demo/AWS/Mqtt_Demo_Helpers/mqtt_pkcs11_demo_helpers.c @@ -807,7 +807,7 @@ BaseType_t xEstablishMqttSession( MQTTContext_t * pxMqttContext, xMqttSessionEstablished = true; } - if( xReturnStatus == pdFAIL ) + if( xReturnStatus != pdFAIL ) { /* Check if session is present and if there are any outgoing publishes * that need to resend. This is only valid if the broker is