Bug fix: iso_node_get_name() of root node returned NULL pointer rather than

an empty string
This commit is contained in:
Thomas Schmitt 2015-09-27 12:30:24 +02:00
parent 395128ef5f
commit 218e26c974
2 changed files with 8 additions and 0 deletions

View File

@ -4768,6 +4768,10 @@ int iso_node_set_name(IsoNode *node, const char *name);
* The returned string belongs to the node and must not be modified nor * The returned string belongs to the node and must not be modified nor
* freed. Use strdup if you really need your own copy. * freed. Use strdup if you really need your own copy.
* *
* Up to version 1.4.2 inquiry of the root directory name returned NULL,
* which is a bug in the light of above description.
* Since 1.4.2 the return value is an empty string.
*
* @since 0.6.2 * @since 0.6.2
*/ */
const char *iso_node_get_name(const IsoNode *node); const char *iso_node_get_name(const IsoNode *node);

View File

@ -414,6 +414,10 @@ int iso_image_set_node_name(IsoImage *image, IsoNode *node, const char *name,
*/ */
const char *iso_node_get_name(const IsoNode *node) const char *iso_node_get_name(const IsoNode *node)
{ {
static char *root = {""};
if (node->name == NULL)
return root;
return node->name; return node->name;
} }