diff --git a/CHANGELOG.md b/CHANGELOG.md index fc06fc76..b4271b02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Append endpoints of weather modules with `/` to retreive the correct data. (Issue [#337](https://github.com/MichMich/MagicMirror/issues/337)) - Corrected grammer in `module.js` from 'suspend' to 'suspended'. - Fixed openweathermap.org URL in config sample. +- Prevent currentweather module from crashing when received data object is incorrect. ### Updated - Updated package.json to fix possible vulnerabilities. (Using snyk) diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index 71fd93c4..db3d5de2 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -217,6 +217,13 @@ Module.register("currentweather",{ * argument data object - Weather information received form openweather.org. */ processWeather: function(data) { + + if (!data || !data.main || !data.main.temp) { + // Did not receive usable new data. + // Maybe this needs a better check? + return; + } + this.temperature = this.roundValue(data.main.temp); if (this.config.useBeaufort){