Add a bit more safety around breadcrumbs
Fixes https://github.com/vector-im/riot-web/issues/11420
This commit is contained in:
parent
2f410c060f
commit
8d25952dbb
1 changed files with 2 additions and 1 deletions
|
@ -126,6 +126,7 @@ export default class AccountSettingsHandler extends MatrixClientBackedSettingsHa
|
||||||
if (!content || !content['recent_rooms']) {
|
if (!content || !content['recent_rooms']) {
|
||||||
content = this._getSettings(BREADCRUMBS_LEGACY_EVENT_TYPE);
|
content = this._getSettings(BREADCRUMBS_LEGACY_EVENT_TYPE);
|
||||||
}
|
}
|
||||||
|
if (!content) content = {}; // If we still don't have content, make some
|
||||||
|
|
||||||
content['recent_rooms'] = newValue;
|
content['recent_rooms'] = newValue;
|
||||||
return MatrixClientPeg.get().setAccountData(BREADCRUMBS_EVENT_TYPE, content);
|
return MatrixClientPeg.get().setAccountData(BREADCRUMBS_EVENT_TYPE, content);
|
||||||
|
@ -167,7 +168,7 @@ export default class AccountSettingsHandler extends MatrixClientBackedSettingsHa
|
||||||
// This seems fishy - try and get the event for the new rooms
|
// This seems fishy - try and get the event for the new rooms
|
||||||
const newType = this._getSettings(BREADCRUMBS_EVENT_TYPE);
|
const newType = this._getSettings(BREADCRUMBS_EVENT_TYPE);
|
||||||
if (newType) val = newType['recent_rooms'];
|
if (newType) val = newType['recent_rooms'];
|
||||||
else val = event.getContent()['rooms'];
|
else val = event.getContent()['rooms'] || [];
|
||||||
} else if (event.getType() === BREADCRUMBS_EVENT_TYPE) {
|
} else if (event.getType() === BREADCRUMBS_EVENT_TYPE) {
|
||||||
val = event.getContent()['recent_rooms'];
|
val = event.getContent()['recent_rooms'];
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue