Skip to content

Commit

Permalink
Don't crash when creating a new message
Browse files Browse the repository at this point in the history
  • Loading branch information
mgdm committed Oct 21, 2013
1 parent adac167 commit 47a92f1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mosquitto_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ static int php_mosquitto_message_read_retain(mosquitto_message_object *mosquitto
static int php_mosquitto_message_read_topic(mosquitto_message_object *mosquitto_object, zval **retval TSRMLS_DC)
{
MAKE_STD_ZVAL(*retval);
ZVAL_STRINGL(*retval, mosquitto_object->message.topic, strlen(mosquitto_object->message.topic), 1);

if (mosquitto_object->message.topic != NULL) {
ZVAL_STRINGL(*retval, mosquitto_object->message.topic, strlen(mosquitto_object->message.topic), 1);
} else {
ZVAL_NULL(*retval);
}

return SUCCESS;
}

Expand Down

0 comments on commit 47a92f1

Please sign in to comment.