Don't crash on error in notification popup

This commit is contained in:
Chocobozzz 2019-02-14 10:07:25 +01:00
parent e1fa026675
commit 9b69bfc076
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.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
if (this.video) this.setAvatarUrl(this.video.channel)
@ -131,6 +134,9 @@ export class UserNotification implements UserNotificationServer {
this.accountUrl = this.buildAccountUrl(this.actorFollow.follower)
break
}
} catch (err) {
console.error(err)
}
}
private buildVideoUrl (video: { uuid: string }) {