[QRA] Check length of the gridsquare isn't greater than 6 chars

This fixes #934 as Cloudlog bearings only works for squares that are less than 6 chars.
pull/976/head
Peter Goodhall 2021-03-30 17:41:56 +01:00
rodzic e3ba7411aa
commit 4c9ba52a9b
1 zmienionych plików z 7 dodań i 5 usunięć

Wyświetl plik

@ -23,12 +23,14 @@ class Qra {
// calculate the bearing between two squares
function bearing($tx, $rx, $unit = 'M') {
$my = qra2latlong($tx);
$stn = qra2latlong($rx);
if(strlen($tx) <= 6 && strlen($rx) <= 6) {
$my = qra2latlong($tx);
$stn = qra2latlong($rx);
$bearing = bearing($my[0], $my[1], $stn[0], $stn[1], $unit);
return $bearing;
$bearing = bearing($my[0], $my[1], $stn[0], $stn[1], $unit);
return $bearing;
}
}
/*