Skip to content

Commit

Permalink
Module: data provider lat/lng might return null if it has not ever ne…
Browse files Browse the repository at this point in the history
…ed set on a display (#2558)

xibosignage/xibo#3428
  • Loading branch information
dasgarner authored Jun 10, 2024
1 parent 5f8f8b7 commit eb40d5d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/Connector/OpenWeatherMapConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ private function getWeatherData(DataProviderInterface $dataProvider)
}

// Build the URL
$url = '?lat=' . $providedLat
. '&lon=' . $providedLon
$url = '?lat=' . ($providedLat ?? '')
. '&lon=' . ($providedLon ?? '')
. '&units=' . $units
. '&lang=' . $dataProvider->getProperty('lang', 'en')
. '&appid=[API_KEY]';
Expand Down
4 changes: 2 additions & 2 deletions lib/Widget/Provider/DataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,15 @@ public function getDisplayId(): int
/**
* @inheritDoc
*/
public function getDisplayLatitude(): float
public function getDisplayLatitude(): ?float
{
return $this->latitude;
}

/**
* @inheritDoc
*/
public function getDisplayLongitude(): float
public function getDisplayLongitude(): ?float
{
return $this->longitude;
}
Expand Down
8 changes: 4 additions & 4 deletions lib/Widget/Provider/DataProviderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ public function getDisplayId(): int;

/**
* Get the latitude for this display
* @return float
* @return float|null
*/
public function getDisplayLatitude(): float;
public function getDisplayLatitude(): ?float;

/**
* Get the longitude for this display
* @return float
* @return float|null
*/
public function getDisplayLongitude(): float;
public function getDisplayLongitude(): ?float;

/**
* Get the preview flag
Expand Down

0 comments on commit eb40d5d

Please sign in to comment.