From 83b3261034aafeea0c3db864a6af8decbcd8d58d Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 9 Nov 2023 15:11:36 +0100 Subject: [PATCH] Fix lookups for empty contest sessions --- application/controllers/Contesting.php | 2 +- application/models/Contesting_model.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/application/controllers/Contesting.php b/application/controllers/Contesting.php index 87343ae5..2ab204b6 100644 --- a/application/controllers/Contesting.php +++ b/application/controllers/Contesting.php @@ -188,7 +188,7 @@ class Contesting extends CI_Controller { $result = $this->Contesting_model->checkIfWorkedBefore($call, $band, $mode, $contest); header('Content-Type: application/json'); - if ($result->num_rows()) { + if ($result && $result->num_rows()) { echo json_encode(array('message' => 'Worked before')); } return; diff --git a/application/models/Contesting_model.php b/application/models/Contesting_model.php index 7bd89215..3ab63248 100644 --- a/application/models/Contesting_model.php +++ b/application/models/Contesting_model.php @@ -214,7 +214,7 @@ class Contesting_model extends CI_Model { $contest_session = $this->getSession(); - if ($contest_session) { + if ($contest_session && $contest_session->qso != "") { $qsoarray = explode(',', $contest_session->qso); $date = DateTime::createFromFormat('d-m-Y H:i:s', $qsoarray[0]);