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:
@@ -245,6 +245,8 @@ duk_ret_t ILibDuktape_DGram_multicastMembership(duk_context *ctx)
|
|||||||
struct sockaddr_in6 multicastAddr;
|
struct sockaddr_in6 multicastAddr;
|
||||||
struct sockaddr_in6 localAddr;
|
struct sockaddr_in6 localAddr;
|
||||||
|
|
||||||
|
if (ptrs->mSocket == NULL) { return ILibDuktape_Error(ctx, "dgram.addMembership(): Invalid Socket"); }
|
||||||
|
|
||||||
duk_push_current_function(ctx);
|
duk_push_current_function(ctx);
|
||||||
duk_get_prop_string(ctx, -1, ILibDuktape_DGRAM_MULTICAST_MEMBERSHIP_TYPE);
|
duk_get_prop_string(ctx, -1, ILibDuktape_DGRAM_MULTICAST_MEMBERSHIP_TYPE);
|
||||||
int isAdd = strcmp((char*)duk_get_string(ctx, -1), "add") == 0 ? 1 : 0;
|
int isAdd = strcmp((char*)duk_get_string(ctx, -1), "add") == 0 ? 1 : 0;
|
||||||
|
|||||||
@@ -206,6 +206,7 @@ void ILibAsyncUDPSocket_DropMulticastGroupV4(ILibAsyncUDPSocket_SocketModule mod
|
|||||||
void ILibAsyncUDPSocket_JoinMulticastGroupV4(ILibAsyncUDPSocket_SocketModule module, struct sockaddr_in *multicastAddr, struct sockaddr *localAddr)
|
void ILibAsyncUDPSocket_JoinMulticastGroupV4(ILibAsyncUDPSocket_SocketModule module, struct sockaddr_in *multicastAddr, struct sockaddr *localAddr)
|
||||||
{
|
{
|
||||||
struct ip_mreq mreq;
|
struct ip_mreq mreq;
|
||||||
|
if (module == NULL) { return; }
|
||||||
#if defined(WIN32) || defined(_WIN32_WCE)
|
#if defined(WIN32) || defined(_WIN32_WCE)
|
||||||
SOCKET s = *((SOCKET*)ILibAsyncSocket_GetSocket(module));
|
SOCKET s = *((SOCKET*)ILibAsyncSocket_GetSocket(module));
|
||||||
#else
|
#else
|
||||||
@@ -224,6 +225,8 @@ void ILibAsyncUDPSocket_JoinMulticastGroupV4(ILibAsyncUDPSocket_SocketModule mod
|
|||||||
|
|
||||||
void ILibAsyncUDPSocket_JoinMulticastGroupV6(ILibAsyncUDPSocket_SocketModule module, struct sockaddr_in6 *multicastAddr, int ifIndex)
|
void ILibAsyncUDPSocket_JoinMulticastGroupV6(ILibAsyncUDPSocket_SocketModule module, struct sockaddr_in6 *multicastAddr, int ifIndex)
|
||||||
{
|
{
|
||||||
|
if (module == NULL) { return; }
|
||||||
|
|
||||||
struct ipv6_mreq mreq6;
|
struct ipv6_mreq mreq6;
|
||||||
#if defined(WIN32) || defined(_WIN32_WCE)
|
#if defined(WIN32) || defined(_WIN32_WCE)
|
||||||
SOCKET s = *((SOCKET*)ILibAsyncSocket_GetSocket(module));
|
SOCKET s = *((SOCKET*)ILibAsyncSocket_GetSocket(module));
|
||||||
|
|||||||
Reference in New Issue
Block a user