[espnow] Fix espnow crash when send() is called without a callback (#17266)

This commit is contained in:
Tom
2026-06-29 20:30:24 +12:00
committed by Jesse Hills
parent 4fbe0d87ec
commit 6251c26cc6
@@ -303,7 +303,9 @@ void ESPNowComponent::loop() {
ESP_LOGV(TAG, ">>> [%s] %s", addr_buf, LOG_STR_ARG(espnow_error_to_str(packet->packet_.sent.status)));
#endif
if (this->current_send_packet_ != nullptr) {
this->current_send_packet_->callback_(packet->packet_.sent.status);
if (this->current_send_packet_->callback_ != nullptr) {
this->current_send_packet_->callback_(packet->packet_.sent.status);
}
this->send_packet_pool_.release(this->current_send_packet_);
this->current_send_packet_ = nullptr; // Reset current packet after sending
}