Add more guards around null notification
This commit is contained in:
parent
ee4442f964
commit
0a5f7171d4
2 changed files with 9 additions and 7 deletions
|
@ -57,6 +57,7 @@ void CocoaNotification::Show(const base::string16& title,
|
||||||
}
|
}
|
||||||
|
|
||||||
void CocoaNotification::Dismiss() {
|
void CocoaNotification::Dismiss() {
|
||||||
|
if (notification_)
|
||||||
[NSUserNotificationCenter.defaultUserNotificationCenter
|
[NSUserNotificationCenter.defaultUserNotificationCenter
|
||||||
removeDeliveredNotification:notification_];
|
removeDeliveredNotification:notification_];
|
||||||
NotificationDismissed();
|
NotificationDismissed();
|
||||||
|
|
|
@ -26,12 +26,13 @@ void OnWebNotificationAllowed(base::WeakPtr<Notification> notification,
|
||||||
const content::PlatformNotificationData& data,
|
const content::PlatformNotificationData& data,
|
||||||
bool audio_muted,
|
bool audio_muted,
|
||||||
bool allowed) {
|
bool allowed) {
|
||||||
if (!allowed) {
|
if (!notification)
|
||||||
notification->Destroy();
|
|
||||||
return;
|
return;
|
||||||
}
|
if (allowed)
|
||||||
notification->Show(data.title, data.body, data.tag, data.icon, icon,
|
notification->Show(data.title, data.body, data.tag, data.icon, icon,
|
||||||
audio_muted ? true : data.silent);
|
audio_muted ? true : data.silent);
|
||||||
|
else
|
||||||
|
notification->Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Loading…
Reference in a new issue