diff --git a/contrib/numeric_score/main.php b/contrib/numeric_score/main.php index 2efddc3a..70ac2379 100644 --- a/contrib/numeric_score/main.php +++ b/contrib/numeric_score/main.php @@ -291,7 +291,12 @@ class NumericScore extends Extension { array("imageid" => $image_id, "userid" => $user_id, "score" => $score)); } $database->Execute( - "UPDATE images SET numeric_score=(SELECT SUM(score) FROM numeric_score_votes WHERE image_id=:imageid) WHERE id=:id", + "UPDATE images SET numeric_score=( + COALESCE( + (SELECT SUM(score) FROM numeric_score_votes WHERE image_id=:imageid), + 0 + ) + ) WHERE id=:id", array("imageid" => $image_id, "id" => $image_id)); } }