summaryrefslogtreecommitdiff
path: root/src/client/http.c
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2013-02-18 22:21:33 +0400
committerAndrey Nazarov <skuller@skuller.net>2013-02-18 22:21:33 +0400
commit9ce9f24f3ef84ff8566bd4b17417fee2d337a67a (patch)
tree8bd5a9970f020de9e2929e5d121fd77356afdd6d /src/client/http.c
parent5a1ece6a2775a7c589f82b4979da210bc1168e4a (diff)
Fix crash on empty filelists.
Diffstat (limited to 'src/client/http.c')
-rw-r--r--src/client/http.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/client/http.c b/src/client/http.c
index f63b070..0777ede 100644
--- a/src/client/http.c
+++ b/src/client/http.c
@@ -644,22 +644,25 @@ static void parse_file_list(dlhandle_t *dl)
char *list;
char *p;
+ if (!dl->buffer)
+ return;
+
if (cl_http_filelists->integer) {
list = dl->buffer;
- while (1) {
+ while (*list) {
p = strchr(list, '\n');
if (p) {
if (p > list && *(p - 1) == '\r')
*(p - 1) = 0;
*p = 0;
- if (*list)
- check_and_queue_download(list);
- list = p + 1;
- } else {
- if (*list)
- check_and_queue_download(list);
- break;
}
+
+ if (*list)
+ check_and_queue_download(list);
+
+ if (!p)
+ break;
+ list = p + 1;
}
}