diff --git a/src/mqtt_client.c b/src/mqtt_client.c index 6cc4cdcb4..dd1a26f1e 100644 --- a/src/mqtt_client.c +++ b/src/mqtt_client.c @@ -1098,7 +1098,7 @@ static int MqttClient_WaitType(MqttClient *client, void *packet_obj, /* if using the shared packet object, make sure the original * state is correct for publish payload 2 (continued) */ - if (use_packet_obj != mms_stat && + if (use_packet_obj != NULL && use_packet_obj != mms_stat && ((MqttMsgStat*)use_packet_obj)->read == MQTT_MSG_PAYLOAD2) { mms_stat->read = MQTT_MSG_PAYLOAD2; }