Mapper: _get_music_directory_utf8() may return nullptr
If no music_directory is configured, return nullptr instead of an empty string. This fixes a crash when db_file is configured without music_directory.
This commit is contained in:
parent
51ec499c89
commit
67b8124a1d
2
NEWS
2
NEWS
@ -1,4 +1,6 @@
|
|||||||
ver 0.18.5 (20??/??/??)
|
ver 0.18.5 (20??/??/??)
|
||||||
|
* configuration
|
||||||
|
- fix crash when db_file is configured without music_directory
|
||||||
* decoder
|
* decoder
|
||||||
- fluidsynth: auto-detect by default
|
- fluidsynth: auto-detect by default
|
||||||
* fix ia64, mipsel and other little-endian architectures
|
* fix ia64, mipsel and other little-endian architectures
|
||||||
|
@ -133,7 +133,9 @@ void mapper_finish(void)
|
|||||||
const char *
|
const char *
|
||||||
mapper_get_music_directory_utf8(void)
|
mapper_get_music_directory_utf8(void)
|
||||||
{
|
{
|
||||||
return music_dir_utf8.c_str();
|
return music_dir_utf8.empty()
|
||||||
|
? nullptr
|
||||||
|
: music_dir_utf8.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
const AllocatedPath &
|
const AllocatedPath &
|
||||||
|
@ -41,7 +41,8 @@ mapper_init(AllocatedPath &&music_dir, AllocatedPath &&playlist_dir);
|
|||||||
void mapper_finish(void);
|
void mapper_finish(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the absolute path of the music directory encoded in UTF-8.
|
* Return the absolute path of the music directory encoded in UTF-8 or
|
||||||
|
* nullptr if no music directory was configured.
|
||||||
*/
|
*/
|
||||||
gcc_const
|
gcc_const
|
||||||
const char *
|
const char *
|
||||||
|
Loading…
Reference in New Issue
Block a user