diff --git a/application/libraries/Qra.php b/application/libraries/Qra.php index 627fade1..48532f1a 100644 --- a/application/libraries/Qra.php +++ b/application/libraries/Qra.php @@ -41,23 +41,29 @@ class Qra { * */ function distance($tx, $rx, $unit = 'M') { - // Calc LatLongs - $my = qra2latlong($tx); - $stn = qra2latlong($rx); - - // Feed in Lat Longs plus the unit type - try - { - $total_distance = distance($my[0], $my[1], $stn[0], $stn[1], $unit); - } - catch (Exception $e) - { - $total_distance = 0; - } - - // Return the distance - return $total_distance; - } + // Calc LatLongs + $my = qra2latlong($tx); + $stn = qra2latlong($rx); + + // Check if qra2latlong returned valid values + if ($my && $stn) { + // Feed in Lat Longs plus the unit type + try + { + $total_distance = distance($my[0], $my[1], $stn[0], $stn[1], $unit); + } + catch (Exception $e) + { + $total_distance = 0; + } + + // Return the distance + return $total_distance; + } else { + // Handle the case where qra2latlong did not return valid values + return 0; + } + } /* * Function returns just the bearing diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index a347e88c..69f06e15 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -2808,10 +2808,10 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = $qsql = "select COL_CLUBLOG_QSO_UPLOAD_STATUS as CL_STATE, COL_QRZCOM_QSO_UPLOAD_STATUS as QRZ_STATE from ".$this->config->item('table_name')." where COL_BAND=? and COL_CALL=? and COL_STATION_CALLSIGN=? and date_format(COL_TIME_ON, '%Y-%m-%d %H:%i') = ?"; $query = $this->db->query($qsql, array($band, $callsign,$station_callsign,$datetime)); $row = $query->row(); - if ($row->QRZ_STATE == 'Y') { + if (($row->QRZ_STATE ?? '') == 'Y') { $data['COL_QRZCOM_QSO_UPLOAD_STATUS'] = 'M'; } - if ($row->CL_STATE == 'Y') { + if (($row->CL_STATE ?? '') == 'Y') { $data['COL_CLUBLOG_QSO_UPLOAD_STATUS'] = 'M'; }