X-Git-Url: https://git.distorted.org.uk/~mdw/disorder/blobdiff_plain/6aba3f6c378b62fbe5ef1bb1ad1ee1ef473e19c6..eb525fcd474c7c30e98e0764698a6fac33eb10ce:/server/trackdb.c?ds=inline diff --git a/server/trackdb.c b/server/trackdb.c index be1aea4..6f89f2a 100644 --- a/server/trackdb.c +++ b/server/trackdb.c @@ -1,6 +1,6 @@ /* * This file is part of DisOrder - * Copyright (C) 2005, 2006 Richard Kettlewell + * Copyright (C) 2005, 2006, 2007 Richard Kettlewell * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -491,9 +491,12 @@ static char **track_to_words(const char *track, struct vector v; char **w; int nw; + const char *rootless = track_rootless(track); + if(!rootless) + rootless = track; /* bodge */ vector_init(&v); - if((w = words(casefold(strip_extension(track_rootless(track))), &nw))) + if((w = words(casefold(strip_extension(rootless)), &nw))) vector_append_many(&v, w, nw); for(; p; p = p->next) @@ -578,9 +581,15 @@ static int compute_alias(char **aliasp, const char *s = config->alias, *t, *expansion, *part; int c, used_db = 0, slash_prefix, err; struct kvp *at; + const char *const root = find_track_root(track); + if(!root) { + /* Bodge for tracks with no root */ + *aliasp = 0; + return 0; + } dynstr_init(&d); - dynstr_append_string(&d, find_track_root(track)); + dynstr_append_string(&d, root); while((c = (unsigned char)*s++)) { if(c != '{') { dynstr_append(&d, c);