Skip to content

Commit b2d3fd7

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents 7b08568 + 35aa32b commit b2d3fd7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ports/espressif/common-hal/mdns/Server.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ mp_obj_t common_hal_mdns_server_find(mdns_server_obj_t *self, const char *servic
117117
next = next->next;
118118
}
119119
mp_obj_tuple_t *tuple = MP_OBJ_TO_PTR(mp_obj_new_tuple(num_results, NULL));
120+
// The empty tuple object is shared and stored in flash so return early if
121+
// we got it. Without this we'll crash when trying to set len below.
122+
if (num_results == 0) {
123+
return MP_OBJ_FROM_PTR(tuple);
124+
}
120125
next = results;
121126
// Don't error if we're out of memory. Instead, truncate the tuple.
122127
uint8_t added = 0;

0 commit comments

Comments
 (0)