From 9cc793e3288ae65e522dce4d48ec31e84b41cdba Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Wed, 8 Mar 2023 19:39:15 +0100 Subject: [PATCH] bugfix --- core/src/utils/net.cpp | 1 + source_modules/hermes_source/src/hermes.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/core/src/utils/net.cpp b/core/src/utils/net.cpp index ff452cbc..ec4511bf 100644 --- a/core/src/utils/net.cpp +++ b/core/src/utils/net.cpp @@ -289,6 +289,7 @@ namespace net { // Save data for (auto iface = addresses; iface; iface = iface->ifa_next) { if (iface->ifa_addr->sa_family != AF_INET) { continue; } + if (!iface->ifa_addr || !iface->ifa_netmask) { continue; } InterfaceInfo info; info.address = ntohl(*(uint32_t*)&iface->ifa_addr->sa_data[2]); info.netmask = ntohl(*(uint32_t*)&iface->ifa_netmask->sa_data[2]); diff --git a/source_modules/hermes_source/src/hermes.cpp b/source_modules/hermes_source/src/hermes.cpp index 6fb99535..6b02a762 100644 --- a/source_modules/hermes_source/src/hermes.cpp +++ b/source_modules/hermes_source/src/hermes.cpp @@ -205,6 +205,7 @@ namespace hermes { } std::vector discover() { + // TODO: Maybe try to instead detect on each interface as a work around for 0.0.0.0 not receiving anything? auto sock = net::openudp("0.0.0.0", 1024); // Build discovery packet