diff --git a/CHANGELOG.md b/CHANGELOG.md index ad4b6698..d450db5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - Fixed issue where wind chill could not be displayed in Fahrenheit. [#1247](https://github.com/MichMich/MagicMirror/issues/1247) +- Fix issues where a module crashes when it tries to dismiss a non exsisting alert. [#1240](https://github.com/MichMich/MagicMirror/issues/1240) ### Updated - Updated italian translation diff --git a/modules/default/alert/alert.js b/modules/default/alert/alert.js index c5d3e650..85d6ef42 100644 --- a/modules/default/alert/alert.js +++ b/modules/default/alert/alert.js @@ -110,11 +110,13 @@ 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); + 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