Fix uncaught Exception in caption_field_value creation

This commit is contained in:
Benoît Burnichon
2016-03-31 11:43:08 +02:00
parent ca4ef347d2
commit eba78f11df

View File

@@ -264,8 +264,13 @@ class caption_Field_Value implements cache_cacheableInterface
// Check consistency
if (! $databox_field->is_multi()) {
$field = $record->get_caption()->get_field($databox_field->get_name());
$values = $field->get_values();
try {
$field = $record->get_caption()->get_field($databox_field->get_name());
$values = $field->get_values();
} catch (Exception $exception) {
// Field was not found, so no values found either
$values = [];
}
if (! empty($values)) {
$caption_field_value = array_pop($values);
/* @var \caption_Field_Value $caption_field_value */