Prevent notice about $post being a "non-object"

There are situation when $post is not a WP_Post Object. I experienced this in a 0 search result case.
This causes a Notice-Warning when „define('WP_DEBUG', true)“:

„Notice: Trying to get property of non-object in …wp-content/plugins/wp-facebook-open-graph-protocol/wp-facebook-ogp.php on line 159 
Notice: Trying to get property of non-object in …wp-includes/post-template.php on line 29 
Notice: Trying to get property of non-object in …wp-content/plugins/wp-facebook-open-graph-protocol/wp-facebook-ogp.php on line 42“