bans.php: do not deserialize post that does not exist

This commit is contained in:
Zankaria 2024-07-14 19:13:51 +02:00
parent 386f9998e1
commit 88eb7d68a7

View file

@ -72,7 +72,7 @@ class Bans {
static private function findSingleNoGc($ban_id) { static private function findSingleNoGc($ban_id) {
$query = prepare( $query = prepare(
'SELECT ``bans``.* FROM ``bans`` 'SELECT ``bans``.* FROM ``bans``
WHERE ``bans``.id = :id WHERE ``bans``.id = :id AND ip
ORDER BY `expires` IS NULL, `expires` DESC ORDER BY `expires` IS NULL, `expires` DESC
LIMIT 1' LIMIT 1'
); );
@ -84,7 +84,9 @@ class Bans {
if ($query->rowCount() == 0) { if ($query->rowCount() == 0) {
return null; return null;
} else { } else {
$ret['post'] = json_decode($ret['post'], true); if ($ret['post']) {
$ret['post'] = json_decode($ret['post'], true);
}
return $ret; return $ret;
} }
} }