aboutsummaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMarvin Borner2020-12-05 18:23:51 +0100
committerMarvin Borner2020-12-05 18:23:51 +0100
commita5e01116f8b28f7ff2e0b33e0ed837be448a43d9 (patch)
tree2e2362aa408f2d015c10720242abca3ac141169d /apps
parentcd2dbb2e146562c9e37c614bb09a24f7fbf135e0 (diff)
Some casual network fixes
Diffstat (limited to 'apps')
-rw-r--r--apps/browser.c4
1 files changed, 2 insertions, 2 deletions
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)) {