-
Notifications
You must be signed in to change notification settings - Fork 133
Open
Description
Am i the only one getting crash with error: java.lang.IllegalStateException: The query result was empty, but expected a single row to return a NON-NULL object of type <com.example.inventory.data
.Item>. When we delete item the ui is still observing UiState and when we delete the item, getItem returns null which room doesnt expect because return value of getItem is Item.
I fixed this by getItem return Item? and then in viewmodel checking for null
.map {item ->
if (item == null) {
ItemDetailsUiState()
} else {
ItemDetailsUiState(
outOfStock = item.quantity <= 0,
itemDetails = item.toItemDetails()
)
}
patelsiddh
Metadata
Metadata
Assignees
Labels
No labels