nextcloud-deck
nextcloud-deck copied to clipboard
`SyncManager#synchronize` should never call callback multiple times
Steps to reproduce the behavior:
- Ensure you have no accounts configured in Deck Android
- Enforce issue, for example simulate throwing NPE as here https://github.com/stefan-niedermann/nextcloud-deck/issues/1337
- Add breakpoints to the
SyncManager#onResponse
/SyncManager#onError
callbacks inImportAccountActivity
- Import account
- Watch both methods being called multiple times
This behavior leads to a race condition resulting in one possible cause of Account.getUserDisplayName()' on a null object reference
exceptions:
The account has been removed due to a error at the first sync but the app thinks everything went fine and tries to display this account (which is null
)
Expected behavior
- Only one method should be called
- The called method should be called only once