Skip to content

Commit 56a77f3

Browse files
committed
Return -1 from NET_WaitUntilInputAvailable() in error cases
1 parent 65d8f55 commit 56a77f3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/SDL_net.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,9 +1974,11 @@ int NET_WaitUntilInputAvailable(void **vsockets, int numsockets, int timeoutms)
19741974
{
19751975
NET_GenericSocket **sockets = (NET_GenericSocket **) vsockets;
19761976
if (!sockets) {
1977-
return SDL_InvalidParamError("sockets");
1977+
SDL_InvalidParamError("sockets");
1978+
return -1;
19781979
} else if (numsockets < 0) {
1979-
return SDL_InvalidParamError("numsockets");
1980+
SDL_InvalidParamError("numsockets");
1981+
return -1;
19801982
} else if (numsockets == 0) {
19811983
return 0;
19821984
}
@@ -1989,7 +1991,8 @@ int NET_WaitUntilInputAvailable(void **vsockets, int numsockets, int timeoutms)
19891991
for (int i = 0; i < numsockets; i++) {
19901992
const NET_GenericSocket *sock = sockets[i];
19911993
if (!sock) {
1992-
return SDL_InvalidParamError("sockets");
1994+
SDL_InvalidParamError("sockets");
1995+
return -1;
19931996
}
19941997
switch (sock->socktype) {
19951998
case SOCKETTYPE_STREAM:

0 commit comments

Comments
 (0)