Index: src/wp-admin/includes/plugin.php
===================================================================
--- src/wp-admin/includes/plugin.php	(revision 46732)
+++ src/wp-admin/includes/plugin.php	(working copy)
@@ -1391,7 +1391,7 @@
 		$submenu[ $parent_slug ][] = $new_sub_menu;
 	} else {
 		// If position is equal or higher than the number of items in the array, append the submenu.
-		if ( $position >= count( $submenu[ $parent_slug ] ) ) {
+		if ( ! isset( $submenu[ $parent_slug ] ) || $position >= count( $submenu[ $parent_slug ] ) ) {
 			$submenu[ $parent_slug ][] = $new_sub_menu;
 		} else {
 			// Test for a negative position.
