Skip to content

Commit

Permalink
Don't crash on null topics
Browse files Browse the repository at this point in the history
  • Loading branch information
mgdm committed Dec 5, 2013
1 parent 484fd3c commit 11fbd99
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mosquitto_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ PHP_METHOD(Mosquitto_Message, tokeniseTopic)

array_init(return_value);
for (i = 0; i < count; i++) {
add_next_index_string(return_value, topics[i], 1);
if (topics[i] == NULL) {
add_next_index_null(return_value);
} else {
add_next_index_string(return_value, topics[i], 1);
}
}

mosquitto_sub_topic_tokens_free(&topics, count);
Expand Down

0 comments on commit 11fbd99

Please sign in to comment.