Skip to content

Commit

Permalink
TransactionScope throws NullPointerException when attempting to commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Tapac authored and SchweinchenFuntik committed Oct 23, 2021
1 parent db1baee commit 81aa528
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TransactionStore<T : Any>(val init: (Transaction.() -> T)? = null) : ReadW
val currentOrNullTransaction = TransactionManager.currentOrNull()
return currentOrNullTransaction?.getUserData(key)
?: init?.let {
val value = currentOrNullTransaction!!.it()
val value = currentOrNullTransaction?.it() ?: error("Can't init value outside the transaction")
currentOrNullTransaction.putUserData(key, value)
value
}
Expand Down

0 comments on commit 81aa528

Please sign in to comment.