Jeroen van Rijn 2 years ago
parent
commit
243a3f5006
1 changed files with 3 additions and 0 deletions
  1. 3 0
      core/net/socket.odin

+ 3 - 0
core/net/socket.odin

@@ -118,6 +118,9 @@ make_unbound_udp_socket :: proc(family: Address_Family) -> (socket: UDP_Socket,
 	The `bound_address` is the address of the network interface that you want to use, or a loopback address if you don't care which to use.
 */
 make_bound_udp_socket :: proc(bound_address: Address, port: int) -> (socket: UDP_Socket, err: Network_Error) {
+	if bound_address == nil {
+		return {}, .Bad_Address
+	}
 	socket = make_unbound_udp_socket(family_from_address(bound_address)) or_return
 	bind(socket, {bound_address, port}) or_return
 	return