port: different fix for chrAlertOthersOfInjury crash

This commit is contained in:
fgsfds committed 2023-09-30 14:17:47 +02:00
1 parent 9a7e9c9ee3
commit 28837dd034
1 file changed
+5 -6
+5 -6
View File
@@ -8275,7 +8275,12 @@ void chrAlertOthersOfInjury(struct chrdata *chr, bool dying)
index = chr->act_dead.notifychrindex;
}
#ifdef AVOID_UB
// notifychrindex can be < 0, so avoid reading g_ChrSlots when that is the case
for (; index >= 0 && index < numchrs && numinrange < 7; index++) {
#else
for (; index < numchrs && numinrange < 7; index++) {
#endif
struct chrdata *loopchr = &g_ChrSlots[index];
if (loopchr->model && loopchr->prop && (loopchr->prop->flags & PROPFLAG_ENABLED)) {
@@ -8488,12 +8493,6 @@ void chrTickDruggedComingUp(struct chrdata *chr)
chrUncloak(chr, true);
chr->actiontype = ACT_DRUGGEDDROP;
#ifdef AVOID_UB
// the function that checks notifychrindex checks for ACT_DRUGGEDDROP,
// so in theory it could check it before the drop animation is finished,
// which will cause a crash. or at least I think that's what's happening
chr->act_die.notifychrindex = 0;
#endif
while (!done) {
if (i >= 0