From cf0b85c7d92c7382cd87d5abb6b3a1bede70de6f Mon Sep 17 00:00:00 2001 From: ivmarkov Date: Sun, 30 Jul 2023 11:12:18 +0000 Subject: [PATCH] Bugfix: ESP IDF mDNS queries might return NULL query results --- src/mdns.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mdns.rs b/src/mdns.rs index 350c47e5188..ec37b5b038d 100644 --- a/src/mdns.rs +++ b/src/mdns.rs @@ -475,8 +475,8 @@ impl Drop for EspMdns { } } -fn copy_query_results(src: *const mdns_result_t, dst: &mut [QueryResult]) -> usize { - if let Some(src) = unsafe { src.as_ref() } { +fn copy_query_results(src: *mut mdns_result_t, dst: &mut [QueryResult]) -> usize { + if !src.is_null() { let mut p = src; let mut i = 0; while !p.is_null() && i < dst.len() {