pdr: pldm_find_entity_ref_in_tree(): Exit early on bad arguments
Perform an early exit in pldm_find_entity_ref_in_tree() such that we're
always in a sensible state to invoke find_entity_ref_in_tree().
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ie92d521d9e8e4febd7ccedffb0ded3a5c1a6eccb
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2d28246..6dd000d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -59,6 +59,7 @@
15. pdr: pldm_entity_get_num_children(): Return zero for invalid arguments
16. pdr: pldm_is_current_parent_child(): Return false for invalid arguments
17. pdr: pldm_entity_association_pdr_add(): Exit early on bad arguments
+18. pdr: pldm_find_entity_ref_in_tree(): Exit early on bad arguments
### Deprecated
diff --git a/src/pdr.c b/src/pdr.c
index 4acdbcf..4cb2bf8 100644
--- a/src/pdr.c
+++ b/src/pdr.c
@@ -986,6 +986,10 @@
pldm_entity entity, pldm_entity_node **node)
{
assert(tree != NULL);
+ if (!tree || !node) {
+ return;
+ }
+
find_entity_ref_in_tree(tree->root, entity, node);
}