pdr: pldm_entity_association_pdr_add(): Exit early on bad arguments

It's not possible to perform the conversion if one or both of tree or
repo are NULL. Explicitly document this case.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I3c77b0d99c5c0badc457a4117312105f22bf5a61
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e4eba1e..e666bb2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -58,6 +58,7 @@
 14. pdr: pldm_entity_association_tree_destroy(): Exit early on bad argument
 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
 
 ### Deprecated
 
diff --git a/include/libpldm/pdr.h b/include/libpldm/pdr.h
index 25aa994..01636ee 100644
--- a/include/libpldm/pdr.h
+++ b/include/libpldm/pdr.h
@@ -412,6 +412,8 @@
 
 /** @brief Convert entity association tree to PDR
  *
+ *  No conversion takes place if one or both of tree or repo are NULL.
+ *
  *  @param[in] tree - opaque pointer to entity association tree
  *  @param[in] repo - PDR repo where entity association records should be added
  *  @param[in] is_remote - if true, then the PDR is not from this terminus
diff --git a/src/pdr.c b/src/pdr.c
index bacdd5d..3223cfb 100644
--- a/src/pdr.c
+++ b/src/pdr.c
@@ -918,6 +918,9 @@
 {
 	assert(tree != NULL);
 	assert(repo != NULL);
+	if (!tree || !repo) {
+		return;
+	}
 
 	entity_association_pdr_add(tree->root, repo, NULL, 0, is_remote,
 				   terminus_handle, 0);