diff --git a/mod/chat/lib.php b/mod/chat/lib.php index 4842fbfedc9..87ecc56066e 100644 --- a/mod/chat/lib.php +++ b/mod/chat/lib.php @@ -212,7 +212,7 @@ function chat_cron () { $sql = "DELETE FROM {$CFG->prefix}chat_messages - WHERE ($subselect) IS NOT NULL AND timestamp < ( ".time()." -($subselect) * 24 * 3600)"; + WHERE ($subselect) > 0 AND timestamp < ( ".time()." -($subselect) * 24 * 3600)"; execute_sql($sql, false);