mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Prevent currentweather module from crashing.
This commit is contained in:
parent
89917c1582
commit
3d3c4ba02f
@ -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))
|
- 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'.
|
- Corrected grammer in `module.js` from 'suspend' to 'suspended'.
|
||||||
- Fixed openweathermap.org URL in config sample.
|
- Fixed openweathermap.org URL in config sample.
|
||||||
|
- Prevent currentweather module from crashing when received data object is incorrect.
|
||||||
|
|
||||||
### Updated
|
### Updated
|
||||||
- Updated package.json to fix possible vulnerabilities. (Using snyk)
|
- Updated package.json to fix possible vulnerabilities. (Using snyk)
|
||||||
|
@ -217,6 +217,13 @@ Module.register("currentweather",{
|
|||||||
* argument data object - Weather information received form openweather.org.
|
* argument data object - Weather information received form openweather.org.
|
||||||
*/
|
*/
|
||||||
processWeather: function(data) {
|
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);
|
this.temperature = this.roundValue(data.main.temp);
|
||||||
|
|
||||||
if (this.config.useBeaufort){
|
if (this.config.useBeaufort){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user