CTD for NULL group members in mqnext branch
mqnext doesn't check for null parameters in GetDistance(), so when using AddSpawn() in MQ2WorstHurt, for mqnext it will CTD if a group member is NULL.
Inserting a check before the AddSpawn() call will prevent it, e.g.:
// Add group members if set to, and we're in a group
if (includeGroup && pChar && pChar->pGroupInfo)
{
for (CGroupMember* pMember : *pChar->pGroupInfo)
{
if (pMember && pMember->pSpawn)
AddSpawn(pMember->pSpawn);
}
}
Currently, with the || in that call, it will evaluate both conditions and crash on NULL.
auto AddSpawn = [&](PSPAWNINFO pSpawn) -> void {
// Ignore spawns if they are null, outside our radius, or they're not a PC/Pet
if (!pSpawn || GetDistance(pCharSpawn, pSpawn) > radius)
return;
Edited by Ron Smith