lsteamclient: Allow callbacks to be NULL

Steamworks API seems to accept NULL callbacks, simply avoiding to call
them when this is the case.
This commit is contained in:
Giovanni Mascellani 2020-11-06 17:42:21 +01:00 committed by Andrew Eikum
parent 8a6964bb3c
commit c559773d00

View file

@ -113,6 +113,9 @@ void *create_LinuxISteamMatchmakingServerListResponse(void *win, const char *ver
{ {
struct gccServerListResponse *ret; struct gccServerListResponse *ret;
if (!win)
return NULL;
/* FIXME: When is it save to free this? CancelServerQuery? */ /* FIXME: When is it save to free this? CancelServerQuery? */
ret = (struct gccServerListResponse *)HeapAlloc(GetProcessHeap(), 0, sizeof(*ret)); ret = (struct gccServerListResponse *)HeapAlloc(GetProcessHeap(), 0, sizeof(*ret));
if(!ret) if(!ret)
@ -163,6 +166,9 @@ void *create_LinuxISteamMatchmakingPingResponse(void *win, const char *version)
{ {
struct gccPingResponse *ret; struct gccPingResponse *ret;
if (!win)
return NULL;
ret = (struct gccPingResponse *)HeapAlloc(GetProcessHeap(), 0, sizeof(*ret)); ret = (struct gccPingResponse *)HeapAlloc(GetProcessHeap(), 0, sizeof(*ret));
if(!ret) if(!ret)
return NULL; return NULL;
@ -217,6 +223,9 @@ void *create_LinuxISteamMatchmakingPlayersResponse(void *win, const char *versio
{ {
struct gccPlayersResponse *ret; struct gccPlayersResponse *ret;
if (!win)
return NULL;
ret = (struct gccPlayersResponse *)HeapAlloc(GetProcessHeap(), 0, sizeof(*ret)); ret = (struct gccPlayersResponse *)HeapAlloc(GetProcessHeap(), 0, sizeof(*ret));
if(!ret) if(!ret)
return NULL; return NULL;
@ -271,6 +280,9 @@ void *create_LinuxISteamMatchmakingRulesResponse(void *win, const char *version)
{ {
struct gccRulesResponse *ret; struct gccRulesResponse *ret;
if (!win)
return NULL;
ret = (struct gccRulesResponse *)HeapAlloc(GetProcessHeap(), 0, sizeof(*ret)); ret = (struct gccRulesResponse *)HeapAlloc(GetProcessHeap(), 0, sizeof(*ret));
if(!ret) if(!ret)
return NULL; return NULL;