From b0644203567014fd1b23bb6a6e64d4a634f758ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Garnier?= Date: Tue, 10 Jan 2023 14:48:44 +0100 Subject: [PATCH] Correction de bug : getLastIndex --- WEB/Controller/ResoudreGateway.php | 3 +++ WEB/Controller/UserController.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/WEB/Controller/ResoudreGateway.php b/WEB/Controller/ResoudreGateway.php index e241fc0c..331042bd 100644 --- a/WEB/Controller/ResoudreGateway.php +++ b/WEB/Controller/ResoudreGateway.php @@ -236,6 +236,9 @@ class ResoudreGateway $this->con->executeQuery($query, array( "partie" => array($idPartie, SQLITE3_INTEGER))); $results=$this->con->getResults(); + if (empty($results)) { + return 0; + } return $results[0]['max(indexEnigme)']; } } \ No newline at end of file diff --git a/WEB/Controller/UserController.php b/WEB/Controller/UserController.php index be9ad63e..b0899f3b 100644 --- a/WEB/Controller/UserController.php +++ b/WEB/Controller/UserController.php @@ -242,7 +242,7 @@ class UserController $idPartie = $_GET['idPartie']; $index = $_GET['index']; $lastIndex = $model->getLastIndex($idPartie); - if($index == $lastIndex + 1){ + if($lastIndex != 0 && $index == $lastIndex + 1){ require($rep . $vues['gameEnd']); } else{