Notice: Trying to get property of non-object

This code tries to retrieve a post instance, but it is failing for some reason.

On top of my head I don’t think this should ever happen within normal operation of menus. I would suspect that menu structure is somehow corrupt.

Without diving into development side of it, an attempt of easy fix might be examining menu in admin and maybe removing entries which appear invalid and/or trying to re–save it.