From 87b287beea2e6dd1a2c814b2d4be3330f16662f6 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Mon, 10 Jan 2022 18:24:39 +0100 Subject: [PATCH] [Distances Worked] Small bugfix when no gridsquare found --- application/models/Distances_model.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/application/models/Distances_model.php b/application/models/Distances_model.php index 7588abbc..35da1edb 100644 --- a/application/models/Distances_model.php +++ b/application/models/Distances_model.php @@ -22,7 +22,7 @@ class Distances_model extends CI_Model $station_gridsquare = $this->find_gridsquare($station_id); - if ($station_gridsquare != "") { + if ($station_gridsquare != null) { $gridsquare = explode(',', $station_gridsquare); // We need to convert to an array, since a user can enter several gridsquares $this->db->select('col_call callsign, col_gridsquare grid'); @@ -96,7 +96,14 @@ class Distances_model extends CI_Model */ function find_gridsquare($station_id) { $this->db->where('station_id', $station_id); - return $this->db->get('station_profile')->row()->station_gridsquare; + + $result = $this->db->get('station_profile')->row_array(); + + if ($result) { + return $result['station_gridsquare']; + } + + return null; } // This functions takes query result from the database and extracts grids from the qso,