fix: [meta-template-name-directory] Do not access property from null object

pull/151/head
Sami Mokaddem 2023-03-23 14:44:05 +01:00
parent 768bbcb996
commit 7df0169ecf
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 7 additions and 3 deletions

View File

@ -47,9 +47,13 @@ echo $this->element('genericElements/IndexTable/index_table', [
'data_path' => 'meta_template.id', 'data_path' => 'meta_template.id',
'element' => 'function', 'element' => 'function',
'function' => function($row, $viewContext) use ($baseurl) { 'function' => function($row, $viewContext) use ($baseurl) {
return $viewContext->Bootstrap->node('a', [ if (!empty($row->meta_template)) {
'href' => h($baseurl . '/metaTemplates/view/' . $row->meta_template->id ?? ''), return $viewContext->Bootstrap->node('a', [
], !empty($row->meta_template->name) ? (sprintf('%s (v%s)', h($row->meta_template->name), h($row->meta_template->version))) :''); 'href' => h($baseurl . '/metaTemplates/view/' . $row->meta_template->id ?? ''),
], !empty($row->meta_template->name) ? (sprintf('%s (v%s)', h($row->meta_template->name), h($row->meta_template->version))) :'');
} else {
return '';
}
} }
], ],
], ],