Merge pull request #3629 from matrix-org/travis/breadcrumbs-fix

Add a bit more safety around breadcrumbs
pull/21833/head
Travis Ralston 2019-11-18 14:35:46 -07:00 committed by GitHub
commit fea8737632
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -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);