Sorry, an error occurred loading the page (500)

/root/www/greensteels/templates/views/newsDetail.pug:6
4| .container: .row: .col-sm-10.col-sm-offset-1.col-md-8.col-md-offset-2
5| article.news-detail
> 6| p: a(href=data.post.categories&&data.post.categories.length>0?'/news/'+data.post.categories[0].key:'/news').back-news ← back to the news
7| hr
8| if !data.post
9| h2 Invalid Post.

Cannot read properties of null (reading 'categories')