Skip to content

Commit

Permalink
check result is not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
lluisd committed May 8, 2024
1 parent 69701cc commit f8f189f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions services/aemet.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const endpointPrefix = 'https://opendata.aemet.es/opendata/api/'
async function getSunsetPrediction(name) {
let sunsetTime = null
const result = await _getTimePrediction(name)
if (result) {
if (result && result.length > 1) {
sunsetTime = result[0].prediccion.dia[0].ocaso
}
return sunsetTime
Expand All @@ -14,7 +14,7 @@ async function getSunsetPrediction(name) {
async function getSunrisePrediction(name) {
let sunsetTime = null
const result = await _getTimePrediction(name)
if (result) {
if (result && result.length > 1) {
sunsetTime = result[0].prediccion.dia[0].orto
}
return sunsetTime
Expand Down

0 comments on commit f8f189f

Please sign in to comment.