Index: src/wp-includes/nav-menu-template.php
===================================================================
--- src/wp-includes/nav-menu-template.php	(revision 54740)
+++ src/wp-includes/nav-menu-template.php	(working copy)
@@ -204,14 +204,14 @@
 		if ( $menu_item->menu_item_parent ) {
 			$menu_items_with_children[ $menu_item->menu_item_parent ] = 1;
 		}
+	}
 
-		// Calculate the depth of each menu item with children
-		foreach ( $menu_items_with_children as $menu_item_key => &$menu_item_depth ) {
-			$menu_item_parent = $menu_items_tree[ $menu_item_key ];
-			while ( $menu_item_parent ) {
-				$menu_item_depth  = $menu_item_depth + 1;
-				$menu_item_parent = $menu_items_tree[ $menu_item_parent ];
-			}
+	// Calculate the depth of each menu item with children
+	foreach ( $menu_items_with_children as $menu_item_key => &$menu_item_depth ) {
+		$menu_item_parent = $menu_items_tree[ $menu_item_key ];
+		while ( $menu_item_parent ) {
+			$menu_item_depth  = $menu_item_depth + 1;
+			$menu_item_parent = $menu_items_tree[ $menu_item_parent ];
 		}
 	}
 
