Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Patch users not existing when opening settings
Browse files Browse the repository at this point in the history
  • Loading branch information
turt2live authored and dbkr committed Mar 5, 2019
1 parent 4c333f8 commit b9bd820
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/views/settings/ProfileSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ export default class ProfileSettings extends React.Component {
super();

const client = MatrixClientPeg.get();
const user = client.getUser(client.getUserId());
let user = client.getUser(client.getUserId());
if (!user) {
// XXX: We shouldn't have to do this.
// There seems to be a condition where the User object won't exist until a room
// exists on the account. To work around this, we'll just create a temporary User
// and use that.
console.warn("User object not found - creating one for ProfileSettings");
user = new User(client.getUserId());
}
let avatarUrl = user.avatarUrl;
if (avatarUrl) avatarUrl = client.mxcUrlToHttp(avatarUrl, 96, 96, 'crop', false);
this.state = {
Expand Down

0 comments on commit b9bd820

Please sign in to comment.