From c8e8ae6baec383d1199c22c3a34dfcbce1db006d Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 24 Dec 2019 23:31:40 +1000 Subject: [PATCH] Fix a division by 0 --- qcsrc/common/mutators/mutator/buffs/sv_buffs.qc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index 256af90af..5789b6e4c 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -227,7 +227,8 @@ void buff_NewType(entity ent) FOREACH(Buffs, buff_Available(it), { // if it's already been chosen, give it a lower priority - RandomSelection_AddEnt(it, max(0.2, 1 / it.buff_seencount), 1); + float myseencount = (it.buff_seencount > 0) ? it.buff_seencount : 1; // no division by zero please! + RandomSelection_AddEnt(it, max(0.2, 1 / myseencount), 1); }); entity newbuff = RandomSelection_chosen_ent; newbuff.buff_seencount += 1; // lower chances of seeing this buff again soon -- 2.39.2