From f6fe0a0cab0c5cf803b13af77af953a3a786c7b2 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Mon, 1 Aug 2005 03:57:32 +0000 Subject: [PATCH] If buglinks queries fail don't try to mysql_fetch_object() on the result --- include/util.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/include/util.php b/include/util.php index 9ae7906..e4b9d3d 100644 --- a/include/util.php +++ b/include/util.php @@ -245,17 +245,25 @@ function getNumberOfImages() /* Get the number of queued bug links in the database */ function getNumberOfQueuedBugLinks() { - $result = query_appdb("SELECT count(*) as num_buglinks FROM buglinks WHERE queued='true';"); - $row = mysql_fetch_object($result); - return $row->num_buglinks; + $hResult = query_appdb("SELECT count(*) as num_buglinks FROM buglinks WHERE queued='true';"); + if($hResult) + { + $row = mysql_fetch_object($hResult); + return $row->num_buglinks; + } + return 0; } /* Get the number of bug links in the database */ function getNumberOfBugLinks() { - $result = query_appdb("SELECT count(*) as num_buglinks FROM buglinks;"); - $row = mysql_fetch_object($result); - return $row->num_buglinks; + $hResult = query_appdb("SELECT count(*) as num_buglinks FROM buglinks;"); + if($hResult) + { + $row = mysql_fetch_object($hResult); + return $row->num_buglinks; + } + return 0; } function lookupVendorName($vendorId)