Fix bug where accounts would be removed while being iterated over
This commit is contained in:
parent
f37da51137
commit
e2af8326e2
|
@ -69,7 +69,8 @@ class AccountsStore extends ChangeNotifier {
|
|||
/// automatically sets default accounts
|
||||
void _assignDefaultAccounts() {
|
||||
// remove dangling defaults
|
||||
_defaultAccounts.entries.map((dft) {
|
||||
_defaultAccounts.entries
|
||||
.map((dft) {
|
||||
final instance = dft.key;
|
||||
final username = dft.value;
|
||||
// if instance or username doesn't exist, remove
|
||||
|
@ -77,7 +78,9 @@ class AccountsStore extends ChangeNotifier {
|
|||
!usernamesFor(instance).contains(username)) {
|
||||
return instance;
|
||||
}
|
||||
}).forEach(_defaultAccounts.remove);
|
||||
})
|
||||
.toList()
|
||||
.forEach(_defaultAccounts.remove);
|
||||
if (_defaultAccount != null) {
|
||||
final instance = _defaultAccount.split('@')[1];
|
||||
final username = _defaultAccount.split('@')[0];
|
||||
|
|
Loading…
Reference in New Issue