From 6168a9b6d51b19378af9ba9977227042cf6eafc6 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Fri, 15 Nov 2013 15:32:53 +0100 Subject: [PATCH] Fix two warnings from Clang's static analyzer. --- src/net_setup.c | 2 ++ src/top.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/net_setup.c b/src/net_setup.c index 601a325..421315b 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -633,6 +633,8 @@ bool setup_myself_reloadable(void) { keylifetime = 3600; get_config_int(lookup_config(config_tree, "AutoConnect"), &autoconnect); + if(autoconnect < 0) + autoconnect = 0; get_config_bool(lookup_config(config_tree, "DisableBuggyPeers"), &disablebuggypeers); diff --git a/src/top.c b/src/top.c index b1ab40c..4db9304 100644 --- a/src/top.c +++ b/src/top.c @@ -213,7 +213,8 @@ static void redraw(void) { for(int i = 0; i < n; i++) sorted[i]->i = i; - qsort(sorted, n, sizeof *sorted, sortfunc); + if(sorted) + qsort(sorted, n, sizeof *sorted, sortfunc); for(int i = 0, row = 3; i < n; i++, row++) { nodestats_t *node = sorted[i]; -- 2.25.1