fixed issue with Trying to get property of non-object

Addresses issue of Notice being thrown when WP_Debug is set to true.  More information on this issue is well explained in the thread: https://github.com/torounit/custom-post-type-permalinks/issues/13