Skip to content

Commit

Permalink
don't remove when not existing
Browse files Browse the repository at this point in the history
  • Loading branch information
bertmelis committed Mar 27, 2023
1 parent 15041c4 commit f13a01d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 0 additions & 2 deletions src/MqttClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ class MqttClient {
espMqttClientTypes::Error error(espMqttClientTypes::Error::SUCCESS);
espMqttClientInternals::Outbox<OutgoingPacket>::Iterator it = _outbox.emplace(0, error, std::forward<Args>(args) ...);
if (it && error == espMqttClientTypes::Error::SUCCESS) return true;
_outbox.remove(it);
return false;
}

Expand All @@ -158,7 +157,6 @@ class MqttClient {
espMqttClientTypes::Error error(espMqttClientTypes::Error::SUCCESS);
espMqttClientInternals::Outbox<OutgoingPacket>::Iterator it = _outbox.emplaceFront(0, error, std::forward<Args>(args) ...);
if (it && error == espMqttClientTypes::Error::SUCCESS) return true;
_outbox.remove(it);
return false;
}

Expand Down
1 change: 1 addition & 0 deletions src/Outbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class Outbox {

// remove node at iterator, iterator points to next
void remove(Iterator& it) { // NOLINT(runtime/references)
if (!it) return;
Node* node = it._node;
Node* prev = it._prev;
++it;
Expand Down

0 comments on commit f13a01d

Please sign in to comment.