diff --git a/Services/Form/classes/class.ilLocationInputGUI.php b/Services/Form/classes/class.ilLocationInputGUI.php index df9e239d6d19..d1d0210296eb 100755 --- a/Services/Form/classes/class.ilLocationInputGUI.php +++ b/Services/Form/classes/class.ilLocationInputGUI.php @@ -1,7 +1,5 @@ lng; $val = $this->strArray($this->getPostVar()); - if ($this->getRequired() && - (trim($val["latitude"]) == "" || trim($val["longitude"]) == "")) { + if ($this->getRequired() && ( + !isset($val["latitude"]) || trim($val["latitude"]) == "" || + !isset($val["longitude"]) || trim($val["longitude"]) == "" + )) { $this->setAlert($lng->txt("msg_input_is_required")); return false; } @@ -113,8 +115,8 @@ public function getInput(): array { $val = $this->strArray($this->getPostVar()); return [ - "latitude" => (float) $val["latitude"], - "longitude" => (float) $val["longitude"], + "latitude" => (float) ($val["latitude"] ?? 0), + "longitude" => (float) ($val["longitude"] ?? 0), "zoom" => (int) ($val["zoom"] ?? 0), "address" => ($val["address"] ?? "") ];