summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2018-09-07 07:02:18 -0400
committerMalf Furious <m@lfurio.us>2018-09-07 07:02:18 -0400
commit575d532b06eeae5eac77f231265e8fd7034d4fd7 (patch)
tree80ebda8a427d092e4e63bdbda99b511e1ec9cad0 /app
parentad49e79ec0b3a49d8d89fb8d190f822d0b2c2268 (diff)
downloadscrott-575d532b06eeae5eac77f231265e8fd7034d4fd7.tar.gz
scrott-575d532b06eeae5eac77f231265e8fd7034d4fd7.zip
Fix bug in function table->loadObj()
If a table query yeilds zero rows, we would still attempt to load the first (index zero) into $this, causing an error to be thrown by PHP. We are now checking the size of the results array first.
Diffstat (limited to 'app')
-rw-r--r--app/class/table.class.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/class/table.class.php b/app/class/table.class.php
index 52a3e7d..28308bb 100644
--- a/app/class/table.class.php
+++ b/app/class/table.class.php
@@ -57,7 +57,13 @@ abstract class table
{
$tbl = database::esc($tbl);
$query = "SELECT * FROM " . $tbl . " WHERE guid = '" . $guid . "'";
- $res = database::query($query)[0];
+ $res = database::query($query);
+
+ /* no results */
+ if (count($res) == 0)
+ continue;
+
+ $res = $res[0];
foreach ($flds as $fld)
{