Commit ea5b54b4 authored by Xiao Deng's avatar Xiao Deng Committed by Nikias Bassen

Return NULL from plist_copy() if passed a NULL pointer

This will prevent an assert if a NULL pointer is passed, and can make
writing some code easier and cleaner without the need for a NULL check.
For example, plist_copy(plist_dict_get_item(dict, "abc")) would give us
a copy of the dict's node if the dict has a value for the given key, or
NULL without any further checks.
parent 517a4f93
......@@ -445,7 +445,7 @@ static plist_t plist_copy_node(node_t *node)
PLIST_API plist_t plist_copy(plist_t node)
{
return plist_copy_node(node);
return node ? plist_copy_node(node) : NULL;
}
PLIST_API uint32_t plist_array_get_size(plist_t node)
......
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