Merge "Fix the maxImage error when Yuv2Rgb in ImageAnalysis" into androidx-main
diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml
index 3a4a3b8..bd25935 100644
--- a/.github/workflows/presubmit.yml
+++ b/.github/workflows/presubmit.yml
@@ -94,7 +94,7 @@
         id: affected-file-args
         run: |
           set -x
-          AFFECTED_FILES=`echo "${{ steps.changed-files.outputs.files_including_removals }}" | grep -v "\s*" | sed 's|[^ ]* *|--changedFilePath=&|g'`
+          AFFECTED_FILES=`echo "${{ steps.changed-files.outputs.files_including_removals }}" | sed 's|[^ ]* *|--changedFilePath=&|g'`
           echo "::set-output name=files::$AFFECTED_FILES"
       - name: "ktlint"
         uses: eskatos/gradle-command-action@v1
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorDark.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorDark.kt
new file mode 100644
index 0000000..1fec7cb
--- /dev/null
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorDark.kt
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+package androidx.compose.material3.tokens
+
+internal object ColorDark {
+    val Background = Palette.Neutral900
+    val Error = Palette.Error200
+    val ErrorStateContent = Palette.Error200
+    val ErrorStateLayer = Error
+    val Hairline = Palette.NeutralVariant700
+    val InverseOnSurface = Palette.Neutral800
+    val InversePrimary = Palette.Primary600
+    val InversePrimaryStateContent = Palette.Primary700
+    val InversePrimaryStateLayer = Palette.Primary600
+    val InverseSurface = Palette.Neutral100
+    val OnBackground = Palette.Neutral100
+    val OnError = Palette.Error800
+    val OnErrorStateContent = OnError
+    val OnErrorStateLayer = Palette.Error50
+    val OnPrimary = Palette.Primary800
+    val OnPrimaryContainer = Palette.Primary100
+    val OnPrimaryContainerStateContent = OnPrimaryContainer
+    val OnPrimaryContainerStateLayer = OnPrimaryContainer
+    val OnPrimaryStateContent = OnPrimary
+    val OnPrimaryStateLayer = OnPrimary
+    val OnSecondary = Palette.Secondary800
+    val OnSecondaryContainer = Palette.Secondary100
+    val OnSecondaryContainerStateContent = OnSecondaryContainer
+    val OnSecondaryContainerStateLayer = OnSecondaryContainer
+    val OnSecondaryStateContent = OnSecondary
+    val OnSecondaryStateLayer = OnSecondary
+    val OnSurface = Palette.Neutral100
+    val OnSurfaceStateContent = Palette.Neutral100
+    val OnSurfaceStateLayer = OnSurface
+    val OnSurfaceVariant = Palette.NeutralVariant200
+    val OnSurfaceVariantStateContent = Palette.NeutralVariant200
+    val OnSurfaceVariantStateLayer = OnSurfaceVariant
+    val OnTertiaryContainer = Palette.Tertiary100
+    val OnTertiaryContainerStateContent = OnTertiaryContainer
+    val OnTertiaryContainerStateLayer = OnTertiaryContainer
+    val Outline = Palette.NeutralVariant400
+    val Primary = Palette.Primary200
+    val PrimaryContainer = Palette.Primary700
+    val PrimaryStateContent = Primary
+    val PrimaryStateLayer = Palette.Primary300
+    val PrimaryVariant = Primary
+    val Secondary = Palette.Secondary200
+    val SecondaryContainer = Palette.Secondary700
+    val SecondaryStateContent = Secondary
+    val SecondaryStateLayer = Palette.Secondary300
+    val SecondaryVariant = Secondary
+    val Shadow = Palette.Neutral1000
+    val Surface = Palette.Neutral900
+    val SurfaceVariant = Palette.NeutralVariant700
+    val TertiaryContainer = Palette.Tertiary700
+    val TextfieldError = Palette.Red200
+    val TextfieldHairline = Palette.Grey400
+    val TextfieldOnSurfaceVariant = Palette.Grey400
+    val TextfieldPrimary = Palette.Blue300
+    val TextfieldStateLayer = Palette.Grey100
+    val TextfieldSurface = Palette.Grey800
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorLight.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorLight.kt
new file mode 100644
index 0000000..c54e194
--- /dev/null
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorLight.kt
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+package androidx.compose.material3.tokens
+
+internal object ColorLight {
+    val Background = Palette.Neutral0
+    val Error = Palette.Error500
+    val ErrorStateContent = Palette.Error800
+    val ErrorStateLayer = Error
+    val Hairline = Palette.NeutralVariant300
+    val InverseOnSurface = Palette.Neutral50
+    val InversePrimary = Palette.Primary200
+    val InversePrimaryStateContent = Palette.Primary200
+    val InversePrimaryStateLayer = Palette.Primary300
+    val InverseSurface = Palette.Neutral800
+    val OnBackground = Palette.Neutral900
+    val OnError = Palette.Error0
+    val OnErrorStateContent = OnError
+    val OnErrorStateLayer = Palette.Neutral900
+    val OnPrimary = Palette.Primary0
+    val OnPrimaryContainer = Palette.Primary900
+    val OnPrimaryContainerStateContent = OnPrimaryContainer
+    val OnPrimaryContainerStateLayer = OnPrimaryContainer
+    val OnPrimaryStateContent = OnPrimary
+    val OnPrimaryStateLayer = Palette.Primary900
+    val OnSecondary = Palette.Secondary0
+    val OnSecondaryContainer = Palette.Secondary900
+    val OnSecondaryContainerStateContent = OnSecondaryContainer
+    val OnSecondaryContainerStateLayer = OnSecondaryContainer
+    val OnSecondaryStateContent = OnSecondary
+    val OnSecondaryStateLayer = Palette.Secondary900
+    val OnSurface = Palette.Neutral900
+    val OnSurfaceStateContent = OnSurface
+    val OnSurfaceStateLayer = OnSurface
+    val OnSurfaceVariant = Palette.NeutralVariant700
+    val OnSurfaceVariantStateContent = OnSurfaceVariant
+    val OnSurfaceVariantStateLayer = OnSurfaceVariant
+    val OnTertiaryContainer = Palette.Tertiary900
+    val OnTertiaryContainerStateContent = OnTertiaryContainer
+    val OnTertiaryContainerStateLayer = OnTertiaryContainer
+    val Outline = Palette.NeutralVariant500
+    val Primary = Palette.Primary600
+    val PrimaryContainer = Palette.Primary100
+    val PrimaryStateContent = Palette.Primary700
+    val PrimaryStateLayer = Primary
+    val PrimaryVariant = Primary
+    val Secondary = Palette.Secondary600
+    val SecondaryContainer = Palette.Secondary100
+    val SecondaryStateContent = Palette.Secondary700
+    val SecondaryStateLayer = Secondary
+    val SecondaryVariant = Secondary
+    val Shadow = Palette.Neutral1000
+    val Surface = Palette.Neutral0
+    val SurfaceVariant = Palette.NeutralVariant100
+    val TertiaryContainer = Palette.Tertiary100
+    val TextfieldError = Palette.Red700
+    val TextfieldHairline = Palette.Grey600
+    val TextfieldOnSurfaceVariant = Palette.Grey700
+    val TextfieldPrimary = Palette.Blue700
+    val TextfieldStateLayer = Palette.Grey800
+    val TextfieldSurface = Palette.Grey100
+}
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorSchemeKey.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorSchemeKey.kt
new file mode 100644
index 0000000..5d41b56
--- /dev/null
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/ColorSchemeKey.kt
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+package androidx.compose
+
+internal enum class ColorSchemeKey {
+    Background,
+    Error,
+    ErrorStateContent,
+    ErrorStateLayer,
+    Hairline,
+    InverseOnSurface,
+    InversePrimary,
+    InversePrimaryStateContent,
+    InversePrimaryStateLayer,
+    InverseSurface,
+    OnBackground,
+    OnError,
+    OnErrorStateContent,
+    OnErrorStateLayer,
+    OnPrimary,
+    OnPrimaryContainer,
+    OnPrimaryContainerStateContent,
+    OnPrimaryContainerStateLayer,
+    OnPrimaryStateContent,
+    OnPrimaryStateLayer,
+    OnSecondary,
+    OnSecondaryContainer,
+    OnSecondaryContainerStateContent,
+    OnSecondaryContainerStateLayer,
+    OnSecondaryStateContent,
+    OnSecondaryStateLayer,
+    OnSurface,
+    OnSurfaceStateContent,
+    OnSurfaceStateLayer,
+    OnSurfaceVariant,
+    OnSurfaceVariantStateContent,
+    OnSurfaceVariantStateLayer,
+    OnTertiaryContainer,
+    OnTertiaryContainerStateContent,
+    OnTertiaryContainerStateLayer,
+    Outline,
+    Primary,
+    PrimaryContainer,
+    PrimaryStateContent,
+    PrimaryStateLayer,
+    PrimaryVariant,
+    Secondary,
+    SecondaryContainer,
+    SecondaryStateContent,
+    SecondaryStateLayer,
+    SecondaryVariant,
+    Shadow,
+    Surface,
+    SurfaceVariant,
+    TertiaryContainer,
+    TextfieldError,
+    TextfieldHairline,
+    TextfieldOnSurfaceVariant,
+    TextfieldPrimary,
+    TextfieldStateLayer,
+    TextfieldSurface,
+    Surface1,
+    Surface2,
+    Surface3,
+    Surface4,
+    Surface5,
+}
\ No newline at end of file
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/Palette.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/Palette.kt
new file mode 100644
index 0000000..fec466b
--- /dev/null
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/tokens/Palette.kt
@@ -0,0 +1,194 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+package androidx.compose.material3.tokens
+
+import androidx.compose.ui.graphics.Color
+
+internal object Palette {
+    val Black = Color(0xFF000000)
+    val Blue0 = Color(0xFFffffff)
+    val Blue10 = Color(0xFFfafbff)
+    val Blue100 = Color(0xFFd3e3fd)
+    val Blue1000 = Color(0xFF000000)
+    val Blue200 = Color(0xFFa8c7fa)
+    val Blue300 = Color(0xFF7cacf8)
+    val Blue400 = Color(0xFF4c8df6)
+    val Blue50 = Color(0xFFecf3fe)
+    val Blue500 = Color(0xFF1b6ef3)
+    val Blue600 = Color(0xFF0b57d0)
+    val Blue700 = Color(0xFF0842a0)
+    val Blue800 = Color(0xFF062e6f)
+    val Blue900 = Color(0xFF041e49)
+    val BlueVariant0 = Color(0xFFffffff)
+    val BlueVariant10 = Color(0xFFf7fcff)
+    val BlueVariant100 = Color(0xFFc2e7ff)
+    val BlueVariant1000 = Color(0xFF000000)
+    val BlueVariant200 = Color(0xFF7fcfff)
+    val BlueVariant300 = Color(0xFF5ab3f0)
+    val BlueVariant400 = Color(0xFF3998d3)
+    val BlueVariant50 = Color(0xFFdff3ff)
+    val BlueVariant500 = Color(0xFF047db7)
+    val BlueVariant600 = Color(0xFF00639b)
+    val BlueVariant700 = Color(0xFF004a77)
+    val BlueVariant800 = Color(0xFF003355)
+    val BlueVariant900 = Color(0xFF001d35)
+    val Error0 = Color(0xFFffffff)
+    val Error10 = Color(0xFFfffbf9)
+    val Error100 = Color(0xFFf9dedc)
+    val Error1000 = Color(0xFF000000)
+    val Error200 = Color(0xFFf2b8b5)
+    val Error300 = Color(0xFFec928e)
+    val Error400 = Color(0xFFe46962)
+    val Error50 = Color(0xFFfceeee)
+    val Error500 = Color(0xFFdc362e)
+    val Error600 = Color(0xFFb3261e)
+    val Error700 = Color(0xFF8c1d18)
+    val Error800 = Color(0xFF601410)
+    val Error900 = Color(0xFF410e0b)
+    val Green0 = Color(0xFFffffff)
+    val Green10 = Color(0xFFf2ffee)
+    val Green100 = Color(0xFFc4eed0)
+    val Green1000 = Color(0xFF000000)
+    val Green200 = Color(0xFF6dd58c)
+    val Green300 = Color(0xFF37be5f)
+    val Green400 = Color(0xFF1ea446)
+    val Green50 = Color(0xFFe7f8ed)
+    val Green500 = Color(0xFF198639)
+    val Green600 = Color(0xFF146c2e)
+    val Green700 = Color(0xFF0f5223)
+    val Green800 = Color(0xFF0a3818)
+    val Green900 = Color(0xFF072711)
+    val Grey0 = Color(0xFFffffff)
+    val Grey10 = Color(0xFFfdfcfb)
+    val Grey100 = Color(0xFFe3e3e3)
+    val Grey1000 = Color(0xFF000000)
+    val Grey200 = Color(0xFFc7c7c7)
+    val Grey300 = Color(0xFFababab)
+    val Grey400 = Color(0xFF8f8f8f)
+    val Grey50 = Color(0xFFf2f2f2)
+    val Grey500 = Color(0xFF757575)
+    val Grey600 = Color(0xFF5e5e5e)
+    val Grey700 = Color(0xFF474747)
+    val Grey800 = Color(0xFF303030)
+    val Grey900 = Color(0xFF1f1f1f)
+    val GreyVariant0 = Color(0xFFffffff)
+    val GreyVariant10 = Color(0xFFfafdfb)
+    val GreyVariant100 = Color(0xFFe1e3e1)
+    val GreyVariant1000 = Color(0xFF000000)
+    val GreyVariant200 = Color(0xFFc4c7c5)
+    val GreyVariant300 = Color(0xFFa9acaa)
+    val GreyVariant400 = Color(0xFF8e918f)
+    val GreyVariant50 = Color(0xFFeff2ef)
+    val GreyVariant500 = Color(0xFF747775)
+    val GreyVariant600 = Color(0xFF5c5f5e)
+    val GreyVariant700 = Color(0xFF444746)
+    val GreyVariant800 = Color(0xFF2d312f)
+    val GreyVariant900 = Color(0xFF191d1c)
+    val Neutral0 = Color(0xFFffffff)
+    val Neutral10 = Color(0xFFfdfdf5)
+    val Neutral100 = Color(0xFFe2e3dc)
+    val Neutral1000 = Color(0xFF000000)
+    val Neutral200 = Color(0xFFc7c7c0)
+    val Neutral300 = Color(0xFFabaca5)
+    val Neutral400 = Color(0xFF90918c)
+    val Neutral50 = Color(0xFFf1f1eb)
+    val Neutral500 = Color(0xFF757771)
+    val Neutral600 = Color(0xFF5d5f5a)
+    val Neutral700 = Color(0xFF464743)
+    val Neutral800 = Color(0xFF2f312d)
+    val Neutral900 = Color(0xFF1a1c18)
+    val NeutralVariant0 = Color(0xFFffffff)
+    val NeutralVariant10 = Color(0xFFf9fef0)
+    val NeutralVariant100 = Color(0xFFe0e4d7)
+    val NeutralVariant1000 = Color(0xFF000000)
+    val NeutralVariant200 = Color(0xFFc4c8bb)
+    val NeutralVariant300 = Color(0xFFa7ada0)
+    val NeutralVariant400 = Color(0xFF8d9286)
+    val NeutralVariant50 = Color(0xFFeef3e4)
+    val NeutralVariant500 = Color(0xFF72786c)
+    val NeutralVariant600 = Color(0xFF5b6056)
+    val NeutralVariant700 = Color(0xFF43483e)
+    val NeutralVariant800 = Color(0xFF2d3228)
+    val NeutralVariant900 = Color(0xFF181d14)
+    val Primary0 = Color(0xFFffffff)
+    val Primary10 = Color(0xFFf6ffe8)
+    val Primary100 = Color(0xFFb7f397)
+    val Primary1000 = Color(0xFF000000)
+    val Primary200 = Color(0xFF9cd67e)
+    val Primary300 = Color(0xFF82ba65)
+    val Primary400 = Color(0xFF689e4d)
+    val Primary50 = Color(0xFFcdffac)
+    val Primary500 = Color(0xFF4e8335)
+    val Primary600 = Color(0xFF386a20)
+    val Primary700 = Color(0xFF205107)
+    val Primary800 = Color(0xFF0c3900)
+    val Primary900 = Color(0xFF042100)
+    val Red0 = Color(0xFFffffff)
+    val Red10 = Color(0xFFfffbf9)
+    val Red100 = Color(0xFFf9dedc)
+    val Red1000 = Color(0xFF000000)
+    val Red200 = Color(0xFFf2b8b5)
+    val Red300 = Color(0xFFec928e)
+    val Red400 = Color(0xFFe46962)
+    val Red50 = Color(0xFFfceeee)
+    val Red500 = Color(0xFFdc362e)
+    val Red600 = Color(0xFFb3261e)
+    val Red700 = Color(0xFF8c1d18)
+    val Red800 = Color(0xFF601410)
+    val Red900 = Color(0xFF410e0b)
+    val Secondary0 = Color(0xFFffffff)
+    val Secondary10 = Color(0xFFf6ffe8)
+    val Secondary100 = Color(0xFFd9e7cb)
+    val Secondary1000 = Color(0xFF000000)
+    val Secondary200 = Color(0xFFbdcbb0)
+    val Secondary300 = Color(0xFFa1b095)
+    val Secondary400 = Color(0xFF87957c)
+    val Secondary50 = Color(0xFFe7f5d8)
+    val Secondary500 = Color(0xFF6d7a63)
+    val Secondary600 = Color(0xFF55624c)
+    val Secondary700 = Color(0xFF3e4a36)
+    val Secondary800 = Color(0xFF273420)
+    val Secondary900 = Color(0xFF131f0d)
+    val Tertiary0 = Color(0xFFffffff)
+    val Tertiary10 = Color(0xFFefffff)
+    val Tertiary100 = Color(0xFFa8eff0)
+    val Tertiary1000 = Color(0xFF000000)
+    val Tertiary200 = Color(0xFF8cd3d4)
+    val Tertiary300 = Color(0xFF70b7b8)
+    val Tertiary400 = Color(0xFF559c9d)
+    val Tertiary50 = Color(0xFFb6fdfe)
+    val Tertiary500 = Color(0xFF388182)
+    val Tertiary600 = Color(0xFF19686a)
+    val Tertiary700 = Color(0xFF004f51)
+    val Tertiary800 = Color(0xFF003738)
+    val Tertiary900 = Color(0xFF002021)
+    val White = Color(0xFFffffff)
+    val Yellow0 = Color(0xFFffffff)
+    val Yellow10 = Color(0xFFfffbf0)
+    val Yellow100 = Color(0xFFffdf99)
+    val Yellow1000 = Color(0xFF000000)
+    val Yellow200 = Color(0xFFffbb29)
+    val Yellow300 = Color(0xFFf09d00)
+    val Yellow400 = Color(0xFFd68400)
+    val Yellow50 = Color(0xFFfff0d1)
+    val Yellow500 = Color(0xFFb26c00)
+    val Yellow600 = Color(0xFF945700)
+    val Yellow700 = Color(0xFF754200)
+    val Yellow800 = Color(0xFF562d00)
+    val Yellow900 = Color(0xFF421f00)
+}
diff --git a/navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt b/navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
index 77a8e32..8b6f14a 100644
--- a/navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
+++ b/navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerRouteTest.kt
@@ -1336,6 +1336,27 @@
         assertThat(backPressedIntercepted).isTrue()
     }
 
+    @UiThreadTest
+    @Test
+    fun testSetGraph13Entries() {
+        val navController = createNavController()
+        val lifecycleOwner = TestLifecycleOwner()
+        val dispatcher = OnBackPressedDispatcher()
+
+        navController.setLifecycleOwner(lifecycleOwner)
+        navController.setOnBackPressedDispatcher(dispatcher)
+
+        val navRepeatedGraph =
+            createNavController().createGraph(route = "nav_root", startDestination = "0") {
+                repeat(13) { index ->
+                    test("$index")
+                }
+            }
+
+        navController.graph = navRepeatedGraph
+        navController.graph = navRepeatedGraph
+    }
+
     private fun createNavController(): NavController {
         val navController = NavController(ApplicationProvider.getApplicationContext())
         val navigator = TestNavigator()
diff --git a/navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt b/navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
index fd2941c..bef31737 100644
--- a/navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
+++ b/navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
@@ -944,7 +944,7 @@
             _graph = graph
             onGraphCreated(startDestinationArgs)
         } else {
-            for (i in 0..graph.nodes.size()) {
+            for (i in 0 until graph.nodes.size()) {
                 val newDestination = graph.nodes.valueAt(i)
                 _graph!!.nodes.replace(i, newDestination)
                 backQueue.filter { currentEntry ->