Merge pull request #1248 from E3V3A/patch-5

null check for notification removal
This commit is contained in:
Michael Teeuw 2018-04-02 14:17:25 +02:00 committed by GitHub
commit 41242a2ae1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed ### Fixed
- Fixed issue where wind chill could not be displayed in Fahrenheit. [#1247](https://github.com/MichMich/MagicMirror/issues/1247) - 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
- Updated italian translation - Updated italian translation

View File

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