diff options
author | Lukas Fleischer <lfleischer@archlinux.org> | 2017-04-18 08:28:08 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2017-04-18 08:37:31 +0200 |
commit | 5553d01ab362e7731da0bb238cc188faacdd3d7e (patch) | |
tree | 6ef4ab3c8466aee997e6a94c31179296aa8e7c0a /web/lib/pkgbasefuncs.inc.php | |
parent | 102dad49e727059441d5566d317e8a57def08b2d (diff) | |
download | aur-5553d01ab362e7731da0bb238cc188faacdd3d7e.tar.gz aur-5553d01ab362e7731da0bb238cc188faacdd3d7e.tar.xz |
Check query return value in pkgbase_user_notify()
Instead of unconditionally calling fetch on the return value of query(),
error out early if the value evaluates to false.
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web/lib/pkgbasefuncs.inc.php')
-rw-r--r-- | web/lib/pkgbasefuncs.inc.php | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php index cd4b2713..57933e86 100644 --- a/web/lib/pkgbasefuncs.inc.php +++ b/web/lib/pkgbasefuncs.inc.php @@ -852,12 +852,11 @@ function pkgbase_user_notify($uid, $base_id) { $q.= " AND PackageBaseID = " . $dbh->quote($base_id); $result = $dbh->query($q); - if ($result->fetch(PDO::FETCH_NUM)) { - return true; - } - else { + if (!$result) { return false; } + + return ($result->fetch(PDO::FETCH_NUM) > 0); } /** |