replace size with isNull for jsondoc. size() walks a linked-list to count the elements, so its time complexity is O(n).

This commit is contained in:
proddy
2024-07-08 15:29:33 +02:00
parent 4f9a32fb36
commit 6f0062be5c

View File

@@ -306,7 +306,7 @@ void WebSchedulerService::publish(const bool force) {
ha_registered_ = ha_created;
if (doc.size() > 0) {
if (!doc.isNull()) {
char topic[Mqtt::MQTT_TOPIC_MAX_SIZE];
snprintf(topic, sizeof(topic), "%s_data", F_(scheduler));
Mqtt::queue_publish(topic, doc.as<JsonObject>());