Skip to content

Commit

Permalink
null check for notification removal
Browse files Browse the repository at this point in the history
Make sure there is something to remove, before we attempt to remove the notifications. 
- This fixes MagicMirrorOrg#1240
  • Loading branch information
E3V3A authored Apr 2, 2018
1 parent 10eb41d commit 497145b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions modules/default/alert/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,14 @@ Module.register("alert",{

},
hide_alert: function(sender) {
//Dismiss alert and remove from this.alerts
this.alerts[sender.name].dismiss();
this.alerts[sender.name] = null;
//Remove overlay
var overlay = document.getElementById("overlay");
overlay.parentNode.removeChild(overlay);
//Dismiss alert and remove from this.alerts
if (this.alerts[sender.name]) {
this.alerts[sender.name].dismiss();
this.alerts[sender.name] = null;
//Remove overlay
var overlay = document.getElementById("overlay");
overlay.parentNode.removeChild(overlay);
}
},
setPosition: function(pos) {
//Add css to body depending on the set position for notifications
Expand Down

1 comment on commit 497145b

@paviro
Copy link

@paviro paviro commented on 497145b Apr 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems logical and is probably the fix :) Shall I test is as well?

Please sign in to comment.