Sorting pages in section

I’m using a pagesdisplay section to show a filtered and sorted list of pages in the panel. I’m using this query:

query: page.kitajahr

And this custom page method:

public function kitajahr()
{
    $year = date('Y');

    if (date('n') < 8) {
        $year--;
    }

    $start = date($year . '-08-01');
    $end = date($year + 1 . '-07-31');

    return $this->children()
        ->filterBy('date', '>=', $start)
        ->filterBy('date', '<=', $end)
        ->sortBy('date', 'desc');
}

This throws an error in the panel:

Call to a member function title() on null

{"status":"error","exception":"Error","message":"Call to a member function title() on null","file":"site\/models\/meal.php","line":8,"code":500,"route":"pages\/([a-zA-Z0-9\\.\\-_%= \\+\\@\\(\\)

If I remove the sorting it works on the first page. But as soon as I navigate to another but the first page, I get the error again.

Any ideas why this is happening?

What is the content of site/models/meal.php on line 8?

Ah, that was the question I needed. I looked at the wrong file the whole time meal not meals. Found the issue (it was an empty title). Thanks!