Don't crash on error in notification popup

pull/1635/head
Chocobozzz 2019-02-14 10:07:25 +01:00
parent 285e04f6dd
commit 344d8be566
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 56 additions and 50 deletions

View File

@ -63,6 +63,9 @@ export class UserNotification implements UserNotificationServer {
this.type = hash.type this.type = hash.type
this.read = hash.read this.read = hash.read
// We assume that some fields exist
// To prevent a notification popup crash in case of bug, wrap it inside a try/catch
try {
this.video = hash.video this.video = hash.video
if (this.video) this.setAvatarUrl(this.video.channel) if (this.video) this.setAvatarUrl(this.video.channel)
@ -131,6 +134,9 @@ export class UserNotification implements UserNotificationServer {
this.accountUrl = this.buildAccountUrl(this.actorFollow.follower) this.accountUrl = this.buildAccountUrl(this.actorFollow.follower)
break break
} }
} catch (err) {
console.error(err)
}
} }
private buildVideoUrl (video: { uuid: string }) { private buildVideoUrl (video: { uuid: string }) {