mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-18 01:41:27 +01:00
Do not set state to null and throw if this occurs (#3191)
This commit is contained in:
parent
76b1798e23
commit
2c9ccefa12
@ -2674,10 +2674,9 @@ export class StateService<
|
|||||||
protected async clearDecryptedDataForActiveUser(): Promise<void> {
|
protected async clearDecryptedDataForActiveUser(): Promise<void> {
|
||||||
await this.updateState(async (state) => {
|
await this.updateState(async (state) => {
|
||||||
const userId = state?.activeUserId;
|
const userId = state?.activeUserId;
|
||||||
if (userId == null || state?.accounts[userId]?.data == null) {
|
if (userId != null && state?.accounts[userId]?.data != null) {
|
||||||
return;
|
state.accounts[userId].data = new AccountData();
|
||||||
}
|
}
|
||||||
state.accounts[userId].data = new AccountData();
|
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
});
|
});
|
||||||
@ -2756,6 +2755,9 @@ export class StateService<
|
|||||||
) {
|
) {
|
||||||
await this.state().then(async (state) => {
|
await this.state().then(async (state) => {
|
||||||
const updatedState = await stateUpdater(state);
|
const updatedState = await stateUpdater(state);
|
||||||
|
if (updatedState == null) {
|
||||||
|
throw new Error("Attempted to update state to null value");
|
||||||
|
}
|
||||||
|
|
||||||
await this.setState(updatedState);
|
await this.setState(updatedState);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user