diff --git a/module/VuFind/src/VuFind/RecordDriver/Feature/MarcReaderTrait.php b/module/VuFind/src/VuFind/RecordDriver/Feature/MarcReaderTrait.php index cc15cf362d3..bc2f3081af8 100644 --- a/module/VuFind/src/VuFind/RecordDriver/Feature/MarcReaderTrait.php +++ b/module/VuFind/src/VuFind/RecordDriver/Feature/MarcReaderTrait.php @@ -81,6 +81,9 @@ public function getRawMarcData() break; } } + if (empty($this->fields[$preferredMarcField])) { + throw new \Exception('Missing MARC data in record ' . $this->getUniqueId()); + } return trim($this->fields[$preferredMarcField]); }