Check for empty user widgets.

pull/21833/head
Richard Lewis 2018-02-07 10:05:50 +00:00
parent 393236ba34
commit f3943bef51
2 changed files with 6 additions and 3 deletions

View File

@ -87,7 +87,6 @@ export default class Stickerpack extends React.Component {
this._getStickerPickerWidget();
return;
}
console.error("Unhandled widget action");
}
_getStickerPickerWidget() {

View File

@ -36,8 +36,12 @@ function getUserWidgets() {
if (!client) {
throw new Error('User not logged in');
}
const userWidgets = client.getAccountData('m.widgets').getContent() || {};
return Object.keys(userWidgets).map((key) => userWidgets[key]);
const userWidgets = client.getAccountData('m.widgets');
let userWidgetContent = {};
if (userWidgets && userWidgets.getContent()) {
userWidgetContent = userWidgets.getContent();
}
return Object.keys(userWidgetContent).map((key) => userWidgetContent[key]);
}
/**