From a5e01116f8b28f7ff2e0b33e0ed837be448a43d9 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 5 Dec 2020 18:23:51 +0100 Subject: Some casual network fixes --- apps/browser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apps/browser.c') diff --git a/apps/browser.c b/apps/browser.c index 6ed83b2..f00f14b 100644 --- a/apps/browser.c +++ b/apps/browser.c @@ -86,8 +86,8 @@ void on_submit(void *event, struct element *box) struct element_label *c = code_label->data; - struct socket *socket = net_open(S_TCP); - if (socket && net_connect(socket, ip, port, NET_TIMEOUT)) { + struct socket *socket = NULL; + if (ip && (socket = net_open(S_TCP)) && net_connect(socket, ip, port, NET_TIMEOUT)) { net_send(socket, query, strlen(query)); char *buf = NULL; if (!(buf = http_receive(socket)) || !html_render(output, http_data(buf), 4096)) { -- cgit v1.2.3