Fix Notice: Trying to get property of non-object

Was getting this notice on a single post page. This got rid of the warning for me.
Merge pull request #187 from matthewsoares/patch-1

Fix Notice: Trying to get property of non-object