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>
This commit is contained in:
Lukas Fleischer 2017-04-18 08:28:08 +02:00
parent 102dad49e7
commit 5553d01ab3

View file

@ -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);
}
/**