From 8587e297ab7aa5b43a913f0e20cfe5edee18f075 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Wed, 9 Dec 2020 10:04:35 +0100 Subject: Fixed null socket loop --- libnet/inc/net.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libnet/inc/net.h b/libnet/inc/net.h index 1b6a17d..e5190c7 100644 --- a/libnet/inc/net.h +++ b/libnet/inc/net.h @@ -46,6 +46,8 @@ static inline int net_connect(struct socket *socket, u32 ip_addr, u16 dst_port, static inline int net_close(struct socket *socket) { + if (!socket) + return 0; int res = 0; while (socket->state == S_CLOSING || !(res = (int)sys1(SYS_NET_CLOSE, (int)(socket)))) yield(); -- cgit v1.2.3