Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 18364)
+++ wp-includes/post.php	(working copy)
@@ -3175,12 +3175,14 @@
 	foreach ( $pages as $page ) {
 		$path = '/' . $leaf_path;
 		$curpage = $page;
-		while ( $curpage->post_parent != 0 ) {
+		while ( !empty($curpage) && $curpage->post_parent != 0 ) {
 			$post_parent = $curpage->post_parent;
 			$curpage = wp_cache_get( $post_parent, 'posts' );
 			if ( false === $curpage )
 				$curpage = $wpdb->get_row( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE ID = %d and post_type = %s", $post_parent, $post_type ) );
-			$path = '/' . $curpage->post_name . $path;
+			if ( isset($curpage->post_name) ) {
+				$path = '/' . $curpage->post_name . $path;
+			}
 		}
 
 		if ( $path == $full_path )
