diff --git a/libraries/WiFi/src/WiFiUdp.cpp b/libraries/WiFi/src/WiFiUdp.cpp index 4e6db72a..acc7a183 100644 --- a/libraries/WiFi/src/WiFiUdp.cpp +++ b/libraries/WiFi/src/WiFiUdp.cpp @@ -221,6 +221,7 @@ int WiFiUDP::parsePacket(){ } remote_ip = IPAddress(si_other.sin_addr.s_addr); remote_port = ntohs(si_other.sin_port); + if (len == 0) return 0; rx_buffer = new cbuf(len); rx_buffer->write(buf, len); delete[] buf; @@ -264,6 +265,7 @@ int WiFiUDP::peek(){ } void WiFiUDP::flush(){ + if(!rx_buffer) return; cbuf *b = rx_buffer; rx_buffer = 0; delete b;