From 951aa2bccb14fa1f5c450aeb116ba9d42c409c0e Mon Sep 17 00:00:00 2001 From: Adam Vessey Date: Mon, 3 Dec 2012 11:58:31 -0400 Subject: [PATCH] Check load success before attempting to use objects. --- includes/utilities.inc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/utilities.inc b/includes/utilities.inc index 375d4aba..537c5dd8 100644 --- a/includes/utilities.inc +++ b/includes/utilities.inc @@ -294,9 +294,11 @@ function islandora_get_datastreams_requirements(FedoraObject $object) { */ function islandora_get_datastreams_requirements_from_models(array $models) { $dsids = array(); - foreach ($models as $model) { - $model = islandora_object_load($model); - $dsids += islandora_get_datastreams_requirements_from_content_model($model); + foreach ($models as $model_pid) { + $model = islandora_object_load($model_pid); + if (isset($model) && $model) { + $dsids += islandora_get_datastreams_requirements_from_content_model($model); + } } // The AUDIT Datastream can not really be added, so it can't really be missing. unset($dsids['AUDIT']);