Skip to content

Commit

Permalink
handled header undefined issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sathyarajv committed Jun 8, 2019
1 parent fe2bcb4 commit 27c5897
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions MMM-OpenmapWeather.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Module.register("MMM-OpenmapWeather",{
firstEvent: false,

// create a variable to hold the location name based on the API result.
fetchedLocatioName: "",
fetchedLocationName: "",

// Define required scripts.
getScripts: function() {
Expand Down Expand Up @@ -288,8 +288,8 @@ Module.register("MMM-OpenmapWeather",{

// Override getHeader method.
getHeader: function() {
if (this.config.appendLocationNameToHeader) {
return this.data.header + " " + this.fetchedLocatioName;
if (this.config.appendLocationNameToHeader && this.data.header !== undefined) {
return this.data.header + " " + this.fetchedLocationName;
}

return this.data.header;
Expand Down Expand Up @@ -407,7 +407,7 @@ Module.register("MMM-OpenmapWeather",{
this.humidity = parseFloat(data.main.humidity);
this.temperature = this.roundValue(data.main.temp);
this.feelsLike = 0;

this.fetchedLocationName=data.name+','+data.sys.country;
if (this.config.useBeaufort){
this.windSpeed = this.ms2Beaufort(this.roundValue(data.wind.speed));
} else if (this.config.useKMPHwind) {
Expand Down

1 comment on commit 27c5897

@sathyarajv
Copy link
Owner Author

Choose a reason for hiding this comment

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

Changes related to #5 issue

Please sign in to comment.