Skip to content

Commit

Permalink
Fix crash on notification when no geolocation is set
Browse files Browse the repository at this point in the history
  • Loading branch information
Hipska committed Mar 27, 2023
1 parent 664d681 commit 27e9202
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 1.9.1 - 2023-03-27
### Fixed
- Crash notification param when no geolocation is set.

## 1.9.0 - 2023-01-31
### Added
- Interactive Google Maps now respect user language.
Expand Down
12 changes: 7 additions & 5 deletions main.sv-geolocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function EnumTemplateVerbs()

/**
* @inheritDoc
* @param ormGeolocation $value
* @param ormGeolocation|null $value
* @return string
*/
function GetForTemplate($value, $sVerb, $oHostObject = null, $bLocalize = true)
Expand All @@ -154,10 +154,12 @@ function GetForTemplate($value, $sVerb, $oHostObject = null, $bLocalize = true)
{
case 'rijksdriehoek':
case 'rd':
return sprintf('%f,%f', $value->getRijksdriehoekX(), $value->getRijksdriehoekY());
if ($value instanceof ormGeolocation) return sprintf('%f,%f', $value->getRijksdriehoekX(), $value->getRijksdriehoekY());
else return;

case 'wgs_84':
return (string) $value;
if ($value instanceof ormGeolocation) return sprintf('%f,%f', $value->getLatitude(), $value->getLongitude());
else return;

default:
return parent::GetForTemplate($value, $sVerb, $oHostObject, $bLocalize);
Expand Down Expand Up @@ -368,8 +370,8 @@ public static function getRijksdriehoekReference()
* Create ormGeolocation object from string input
*
* @since 1.8.0
* @param string $sInput
* @return static
* @param string|null $sInput
* @return static|null
*/
public static function fromString(?string $sInput)
{
Expand Down
2 changes: 1 addition & 1 deletion module.sv-geolocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'sv-geolocation/1.9.0',
'sv-geolocation/1.9.1',
array(
// Identification
//
Expand Down

0 comments on commit 27e9202

Please sign in to comment.