]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix division by 0 error on map start if dynamic handicap is enabled
authorterencehill <piuntn@gmail.com>
Sun, 18 May 2025 00:34:08 +0000 (02:34 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 18 May 2025 00:34:08 +0000 (02:34 +0200)
qcsrc/common/mutators/mutator/dynamic_handicap/sv_dynamic_handicap.qc

index 4796830d4823d6d2a9f1f29522e1105bb4393a14..d8054b3c72bb3313e5ab1a62fbe9960f32e3181f 100644 (file)
@@ -38,6 +38,9 @@ void DynamicHandicap_UpdateHandicap()
                total_score += PlayerScore_Get(it, SP_SCORE);
                ++totalplayers;
        });
+       if (totalplayers == 0)
+               return;
+
        float mean_score = total_score / totalplayers;
        FOREACH_CLIENT(true,
        {