Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix empty list exception #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lngyeen
Copy link

@lngyeen lngyeen commented Aug 4, 2022

java.util.NoSuchElementException: List is empty.
at kotlin.collections.CollectionsKt___CollectionsKt.first(_Collections.kt:212)
at uk.co.moodio.msal_flutter.MsalFlutterPlugin.clearAccounts(MsalFlutterPlugin.kt:157)

java.util.NoSuchElementException: List is empty.
at kotlin.collections.CollectionsKt___CollectionsKt.first(_Collections.kt:212)
at uk.co.moodio.msal_flutter.MsalFlutterPlugin.clearAccounts(MsalFlutterPlugin.kt:157)
@mswehli
Copy link
Contributor

mswehli commented Aug 9, 2022

Hi @lngyeen thanks for the PR.
Can you give a bit more context in when you got the exception? As we already check to make sure the account list is not empty with the any() function call, so the issue might be caused by something else such as parallel calls

@lngyeen
Copy link
Author

lngyeen commented Aug 23, 2022

@mswehli The exception occurred when I try to sign out right after signing in, not always but sometimes.
Another point is, take a look at msalApp.accounts, you can see that is a computed property (not stored property), that mean the msalApp.account on line 156 may be different from line 157.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants