Index: src/wp-includes/template.php
===================================================================
--- src/wp-includes/template.php	(revision 39912)
+++ src/wp-includes/template.php	(working copy)
@@ -135,8 +135,9 @@
 		$post_type = reset( $post_type );
 
 	$obj = get_post_type_object( $post_type );
-	if ( ! $obj->has_archive )
+	if ( ! ( $obj instanceof WP_Post_Type ) || ! $obj->has_archive ) {
 		return '';
+	}
 
 	return get_archive_template();
 }
