Sat, 25 Aug 2018 15:12:38 +0200
fixes url completion segfaulting for empty strings (in case the user hasn't already started typing an URL)
dav/main.c | file | annotate | diff | comparison | revisions |
--- a/dav/main.c Sat Aug 25 14:41:02 2018 +0200 +++ b/dav/main.c Sat Aug 25 15:12:38 2018 +0200 @@ -2069,7 +2069,9 @@ if(!strcmp(cmd, "date")) { return 0; } - char *url = args->argv[3]; + + // get already typed URL or NULL, if the user hasn't started typing yet + char *url = args->argc > 3 ? args->argv[3] : NULL; //printf("index: {%s}\n", args->argv[0]); //printf("dav: {%s}\n", args->argv[1]); @@ -2094,7 +2096,9 @@ } int url_completion(char *u) { - sstr_t url = sstr(u); + sstr_t url; + url.ptr = u; + url.length = u ? strlen(u) : 0; // repo completion int repocomp = 1;