Skip to content

Commit 8d67f80

Browse files
committed
Synchronize both check and removal of empty decisions list
1 parent c8dffd9 commit 8d67f80

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/src/main/java/at/bitfire/cert4android/UserDecisionRegistry.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ class UserDecisionRegistry private constructor(
5353
// User decision possible → remember request in pendingDecisions so that a later decision will be applied to this request
5454

5555
cont.invokeOnCancellation {
56-
val decisionsList = pendingDecisions[cert]
57-
58-
// remove from pending decisions on cancellation
5956
synchronized(pendingDecisions) {
57+
val decisionsList = pendingDecisions[cert]
58+
59+
// remove from pending decisions on cancellation
6060
decisionsList?.remove(cont)
61-
}
6261

63-
// Remove decisions list if empty
64-
if (decisionsList?.isEmpty() == true)
65-
pendingDecisions.remove(cert)
62+
// Remove decisions list if empty
63+
if (decisionsList?.isEmpty() == true)
64+
pendingDecisions -= cert
65+
}
6666

6767
val nm = NotificationUtils.createChannels(context)
6868
nm.cancel(CertUtils.getTag(cert), NotificationUtils.ID_CERT_DECISION)

0 commit comments

Comments
 (0)