Skip to content

Commit 0eeffca

Browse files
committed
Fix crash after splitting shipments
1 parent 2096e3c commit 0eeffca

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/orders/wooshippinglabels/WooShippingLabelCreationViewModel.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -818,14 +818,13 @@ class WooShippingLabelCreationViewModel @Inject constructor(
818818
}
819819

820820
fun onShipmentSplit(newShipments: List<ShipmentUIModel>) {
821-
shipments.value = newShipments
822821
if (selectedShipmentIndex >= newShipments.size) {
823822
uiState.update {
824823
it.copy(selectedIndex = it.selectedIndex.coerceAtMost(newShipments.size - 1))
825824
}
826-
} else {
827-
resetWeight(selectedShipmentIndex)
828825
}
826+
shipments.value = newShipments
827+
resetWeight(selectedShipmentIndex)
829828
}
830829

831830
fun onShippingLabelRefunded(labelId: Long) {

0 commit comments

Comments
 (0)