1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-06 00:13:33 +00:00

Fixed NULL reference exception

This commit is contained in:
Bryan Roe
2022-03-25 11:19:00 -07:00
parent c3591f5de6
commit 9e4be92cd8
2 changed files with 5 additions and 0 deletions

View File

@@ -245,6 +245,8 @@ duk_ret_t ILibDuktape_DGram_multicastMembership(duk_context *ctx)
struct sockaddr_in6 multicastAddr;
struct sockaddr_in6 localAddr;
if (ptrs->mSocket == NULL) { return ILibDuktape_Error(ctx, "dgram.addMembership(): Invalid Socket"); }
duk_push_current_function(ctx);
duk_get_prop_string(ctx, -1, ILibDuktape_DGRAM_MULTICAST_MEMBERSHIP_TYPE);
int isAdd = strcmp((char*)duk_get_string(ctx, -1), "add") == 0 ? 1 : 0;

View File

@@ -206,6 +206,7 @@ void ILibAsyncUDPSocket_DropMulticastGroupV4(ILibAsyncUDPSocket_SocketModule mod
void ILibAsyncUDPSocket_JoinMulticastGroupV4(ILibAsyncUDPSocket_SocketModule module, struct sockaddr_in *multicastAddr, struct sockaddr *localAddr)
{
struct ip_mreq mreq;
if (module == NULL) { return; }
#if defined(WIN32) || defined(_WIN32_WCE)
SOCKET s = *((SOCKET*)ILibAsyncSocket_GetSocket(module));
#else
@@ -224,6 +225,8 @@ void ILibAsyncUDPSocket_JoinMulticastGroupV4(ILibAsyncUDPSocket_SocketModule mod
void ILibAsyncUDPSocket_JoinMulticastGroupV6(ILibAsyncUDPSocket_SocketModule module, struct sockaddr_in6 *multicastAddr, int ifIndex)
{
if (module == NULL) { return; }
struct ipv6_mreq mreq6;
#if defined(WIN32) || defined(_WIN32_WCE)
SOCKET s = *((SOCKET*)ILibAsyncSocket_GetSocket(module));