From af3ddddcf4d061f080b21a2015053c7f446efef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sat, 19 Jul 2025 16:11:44 +0200 Subject: [PATCH] Copilot suggestion Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/platform/nrf52/AsyncUDP.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/platform/nrf52/AsyncUDP.cpp b/src/platform/nrf52/AsyncUDP.cpp index dd76ebcc5..956105cdf 100644 --- a/src/platform/nrf52/AsyncUDP.cpp +++ b/src/platform/nrf52/AsyncUDP.cpp @@ -37,7 +37,11 @@ bool AsyncUDP::writeTo(const uint8_t *data, size_t len, IPAddress ip, uint16_t p // AsyncUDPPacket AsyncUDPPacket::AsyncUDPPacket(EthernetUDP &source) : _udp(source), _remoteIP(source.remoteIP()), _remotePort(source.remotePort()) { - _readLength = _udp.read(_buffer, sizeof(_buffer)); + if (_udp.available() > 0) { + _readLength = _udp.read(_buffer, sizeof(_buffer)); + } else { + _readLength = 0; + } } IPAddress AsyncUDPPacket::remoteIP()