From d470b722caedc06969b1572c1801d5f1bc257316 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Wed, 4 Feb 2026 09:45:31 +0100 Subject: [PATCH] [Advanced Logbook] Fix error 500 if unit is set to mi or nmi --- src/QSLManager/QSO.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/QSLManager/QSO.php b/src/QSLManager/QSO.php index beef7ac55..c4b87d9ab 100644 --- a/src/QSLManager/QSO.php +++ b/src/QSLManager/QSO.php @@ -1317,6 +1317,8 @@ class QSO { if ($this->distance === null) return ''; + $distanceValue = floatval($this->distance); // Convert string to float + switch ($this->measurement_base) { case 'M': $unit = "mi"; @@ -1329,16 +1331,16 @@ class QSO break; default: $unit = "km"; - } + } if ($unit == 'mi') { - $this->distance = round($this->distance * 0.621371, 1); + $distanceValue = round($distanceValue * 0.621371, 1); } if ($unit == 'nmi') { - $this->distance = round($this->distance * 0.539957, 1); + $distanceValue = round($distanceValue * 0.539957, 1); } - return $this->distance . ' ' . $unit; + return $distanceValue . ' ' . $unit; } private function getFormattedMyDok(): string