pdr: pldm_entity_association_tree_destroy_root(): Exit early on bad arg

Also identify the condition in the doxygen commentary in the header.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I706dc4364424163e51d6d2b17168f3dba280522b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ec6ab3f..4549384 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -61,6 +61,7 @@
 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
 19. pdr: pldm_entity_association_tree_find(): Early exit on bad arguments
+20. pdr: pldm_entity_association_tree_destroy_root(): Exit early on bad arg
 
 ### Deprecated
 
diff --git a/include/libpldm/pdr.h b/include/libpldm/pdr.h
index e656ced..b05085f 100644
--- a/include/libpldm/pdr.h
+++ b/include/libpldm/pdr.h
@@ -530,6 +530,8 @@
 /** @brief Destroy all the nodes of the entity association tree
  *
  *  @param[in] tree - pointer to entity association tree
+ *
+ *  There is no tree to destroy if tree is NULL.
  */
 void pldm_entity_association_tree_destroy_root(
 	pldm_entity_association_tree *tree);
diff --git a/src/pdr.c b/src/pdr.c
index 3ee8886..8948ea0 100644
--- a/src/pdr.c
+++ b/src/pdr.c
@@ -1231,6 +1231,10 @@
 	pldm_entity_association_tree *tree)
 {
 	assert(tree != NULL);
+	if (!tree) {
+		return;
+	}
+
 	entity_association_tree_destroy(tree->root);
 	tree->last_used_container_id = 0;
 	tree->root = NULL;