Browse Source

Merge pull request #508 from Hoikas/crash

Fix SittingModifier null dereference
Adam Johnson 10 years ago
parent
commit
1b1ecf2c7f
  1. 4
      Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.cpp

4
Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.cpp

@ -156,6 +156,7 @@ bool plSittingModifier::MsgReceive(plMessage *msg)
// own notify messages -- // own notify messages --
plKey avatarKey = notifyMsg->GetAvatarKey(); plKey avatarKey = notifyMsg->GetAvatarKey();
plSceneObject * obj = plSceneObject::ConvertNoRef(avatarKey->ObjectIsLoaded()); plSceneObject * obj = plSceneObject::ConvertNoRef(avatarKey->ObjectIsLoaded());
if (obj) {
const plArmatureMod * avMod = (plArmatureMod*)obj->GetModifierByType(plArmatureMod::Index()); const plArmatureMod * avMod = (plArmatureMod*)obj->GetModifierByType(plArmatureMod::Index());
plAvBrainHuman *brain = (avMod ? plAvBrainHuman::ConvertNoRef(avMod->GetCurrentBrain()) : nil); plAvBrainHuman *brain = (avMod ? plAvBrainHuman::ConvertNoRef(avMod->GetCurrentBrain()) : nil);
if (brain && !brain->IsRunningTask()) if (brain && !brain->IsRunningTask())
@ -182,6 +183,7 @@ bool plSittingModifier::MsgReceive(plMessage *msg)
Trigger(avMod, notifyEnter, notifyExit); Trigger(avMod, notifyEnter, notifyExit);
} }
} }
}
// eat the message either way // eat the message either way
result = true; result = true;
} else if (notifyMsg->fState == 0.0f && msg->GetSender() == GetKey()) { } else if (notifyMsg->fState == 0.0f && msg->GetSender() == GetKey()) {
@ -196,6 +198,7 @@ bool plSittingModifier::MsgReceive(plMessage *msg)
{ {
plKey avatarKey = notifyMsg->GetAvatarKey(); plKey avatarKey = notifyMsg->GetAvatarKey();
plSceneObject * obj = plSceneObject::ConvertNoRef(avatarKey->ObjectIsLoaded()); plSceneObject * obj = plSceneObject::ConvertNoRef(avatarKey->ObjectIsLoaded());
if (obj) {
plArmatureMod * avMod = (plArmatureMod*)obj->GetModifierByType(plArmatureMod::Index()); plArmatureMod * avMod = (plArmatureMod*)obj->GetModifierByType(plArmatureMod::Index());
uint32_t flags = kBCastToClients | kUseRelevanceRegions | kForceFullSend; uint32_t flags = kBCastToClients | kUseRelevanceRegions | kForceFullSend;
@ -203,6 +206,7 @@ bool plSittingModifier::MsgReceive(plMessage *msg)
} }
} }
} }
}
return result || plSingleModifier::MsgReceive(msg); return result || plSingleModifier::MsgReceive(msg);
} }

Loading…
Cancel
Save