Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 18578)
+++ wp-includes/post.php	(working copy)
@@ -3164,17 +3164,18 @@
 		if ( $page->post_name == $revparts[0] ) {
 			$count = 0;
 			if ( $page->post_parent != 0 ) {
-				if ( null === ( $parent_page = $pages[ $page->post_parent ] ) )
+				$parent_page = ( isset( $pages[ $page->post_parent ] ) ) ? $pages[ $page->post_parent ] : null;
+				if ( empty($parent_page) )
 					continue;
 
-				while ( $parent_page->ID != 0 ) {
+				while ( !empty($parent_page) ) {
 					$count++;
 					if ( $parent_page->post_name != $revparts[ $count ] )
 						break;
-					$parent_page = $pages[ $parent_page->post_parent ];
+					$parent_page = ( isset( $pages[ $parent_page->post_parent ] ) ) ? $pages[ $parent_page->post_parent ] : null;
 				}
 
-				if ( $parent_page->ID == 0 && $count+1 == count($revparts) ) {
+				if ( empty($parent_page) && $count+1 == count($revparts) ) {
 					$foundid = $page->ID;
 					break;
 				}
