Fix error when user setting is null

master
Max 5 years ago
parent 80fe4cffcd
commit 91e9068fb9

@ -41,11 +41,13 @@ export class User {
this.joinedAt = userDataResponse.joinedAt; this.joinedAt = userDataResponse.joinedAt;
this.friendCount = userDataResponse.friendCount; this.friendCount = userDataResponse.friendCount;
this.groupCount = userDataResponse.groupCount; this.groupCount = userDataResponse.groupCount;
if (userDataResponse.settings) {
try { try {
this.darkmode = !!JSON.parse(userDataResponse.settings).darkmode; this.darkmode = !!JSON.parse(userDataResponse.settings).darkmode;
} catch (err) { } catch (err) {
console.error(err); console.error(err);
} }
}
if (userDataResponse.friends) { if (userDataResponse.friends) {
this.friends = userDataResponse.friends this.friends = userDataResponse.friends
.map(friend => new FriendInfo( .map(friend => new FriendInfo(

Loading…
Cancel
Save