diff --git a/OpenAIREPlugin.php b/OpenAIREPlugin.php index fc2aa31..90ffa8d 100644 --- a/OpenAIREPlugin.php +++ b/OpenAIREPlugin.php @@ -109,8 +109,10 @@ public function initDataSectionFormFields($hookName, $args) { $request = Application::get()->getRequest(); $context = $request->getContext(); $contextId = $context ? $context->getId() : CONTEXT_ID_NONE; - $section = Repo::section()->get($sectionForm->getSectionId()); - if ($section) $sectionForm->setData('resourceType', $section->getData('resourceType')); + if ($sectionForm->getSectionId()) { + $section = Repo::section()->get($sectionForm->getSectionId()); + if ($section) $sectionForm->setData('resourceType', $section->getData('resourceType')); + } } /**