Commit 3b6efa99 authored by Max Kellermann's avatar Max Kellermann

directory: directory_get_path(NULL) is not allowed

Also convert directory_get_path() to an inline function, which returns a constant string.
parent 68977af6
......@@ -70,6 +70,14 @@ directory_is_empty(struct directory *directory)
return directory->children.nr == 0 && directory->songs.nr == 0;
}
static inline const char *
directory_get_path(struct directory *directory)
{
if (directory->path == NULL)
return "";
return directory->path;
}
void
directory_prune_empty(struct directory *directory);
......@@ -94,6 +102,4 @@ directory_walk(struct directory *directory,
int (*forEachDir)(struct directory *, void *),
void *data);
#define directory_get_path(dir) ((dir && dir->path) ? dir->path : "")
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment