Added check for valid QOS (0 or 1)

This commit is contained in:
Mark Cheverton 2013-11-29 00:18:55 +00:00
parent 359fd03f03
commit 94df17720e

View File

@ -306,6 +306,9 @@ boolean PubSubClient::subscribe(char* topic) {
} }
boolean PubSubClient::subscribe(char* topic, uint8_t qos) { boolean PubSubClient::subscribe(char* topic, uint8_t qos) {
if (qos < 0 || qos > 1)
return false;
if (connected()) { if (connected()) {
// Leave room in the buffer for header and variable length field // Leave room in the buffer for header and variable length field
uint16_t length = 5; uint16_t length = 5;