# HG changeset patch # User Mike Becker # Date 1535202758 -7200 # Node ID 295eaa04fc41f7d6f53d4ca48c51daa54ed5d5ca # Parent 0eabb741d5d3537e0afa3e89e5ab5b22ffb0a511 fixes url completion segfaulting for empty strings (in case the user hasn't already started typing an URL) diff -r 0eabb741d5d3 -r 295eaa04fc41 dav/main.c --- 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;