From 3d95916c2979ba9ca5c472cb17733690dbcdb983 Mon Sep 17 00:00:00 2001 From: Hubert Walczak Date: Sun, 9 Jul 2023 12:03:56 +0200 Subject: [PATCH] Fix for db throws and install process not going through --- GameEngine/Database.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index e244372e..a695c0f4 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -1356,6 +1356,7 @@ class MYSQLi_DB implements IDbConnection { } function setFieldTaken($id) { + if(empty($id)) return; if (!is_array($id)) { $id = [$id]; } @@ -5655,6 +5656,8 @@ References: User ID/Message ID, Mode list($moveid) = $this->escape_input($moveid); } + if(empty($moveid)) return; + // rather than re-selecting data and updating cache here, let's just // flush the cache and let it re-cach itself as neccessary self::$marketMovementCache = []; @@ -6012,6 +6015,7 @@ References: User ID/Message ID, Mode function addUnits($vid, $troopsArray = null) { list($vid, $type, $values) = $this->escape_input($vid, $type, $values); + if(empty($vid)) return; if (!is_array($vid)) $vid = [$vid]; $types = $values = ""; @@ -6201,6 +6205,7 @@ References: User ID/Message ID, Mode } function addTech($vid) { + if(empty($vid)) return; if (!is_array($vid)) { $vid = [$vid]; } @@ -6214,6 +6219,7 @@ References: User ID/Message ID, Mode } function addABTech($vid) { + if(empty($vid)) return; if (!is_array($vid)) { $vid = [$vid]; } @@ -7056,9 +7062,13 @@ References: User ID/Message ID, Mode try { // check that we don't have the structure in place already // (we'd have at least 1 user present, since 4 are being created by default - Support, Nature, Multihunter & Taskmaster) - $data_exist = $this->query_return("SELECT * FROM " . TB_PREFIX . "users LIMIT 1"); - if ($data_exist && count($data_exist)) { - return false; + try { + $data_exist = $this->query_return("SELECT * FROM " . TB_PREFIX . "users LIMIT 1"); + if ($data_exist && count($data_exist)) { + return false; + } + } catch (\Exception $e) { + } // load the DB structure SQL file @@ -7073,6 +7083,7 @@ References: User ID/Message ID, Mode return false; } } catch (\Exception $e) { + echo($e); return -1; }