diff --git a/classes/template/PKPTemplateManager.php b/classes/template/PKPTemplateManager.php index 65e96ef3331..3e9fb5189e7 100644 --- a/classes/template/PKPTemplateManager.php +++ b/classes/template/PKPTemplateManager.php @@ -1216,7 +1216,7 @@ public function display($template = null, $cache_id = null, $compile_id = null, $context = $request->getContext(); $pageContext = [ - 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context->getPath()) + 'apiBaseUrl' => $dispatcher->url($request, PKPApplication::ROUTE_API, $context?->getPath() ?: 'index') ]; $output .= 'pkp.context = ' . json_encode($pageContext) . ';';