Skip to content

Instantly share code, notes, and snippets.

@tst12
Created May 17, 2012 20:52
Show Gist options
  • Save tst12/2721525 to your computer and use it in GitHub Desktop.
Save tst12/2721525 to your computer and use it in GitHub Desktop.
diff --git a/src/game/Object.h b/src/game/Object.h
index 3b10ea5..7f19c54 100644
--- a/src/game/Object.h
+++ b/src/game/Object.h
@@ -511,7 +511,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object
float GetDistanceZ(const WorldObject* obj) const;
bool IsInMap(const WorldObject* obj) const
{
- return IsInWorld() && obj->IsInWorld() && (GetMap() == obj->GetMap()) && InSamePhase(obj);
+ return obj && IsInWorld() && obj->IsInWorld() && (GetMap() == obj->GetMap()) && InSamePhase(obj);
}
bool IsWithinDist3d(float x, float y, float z, float dist2compare) const;
bool IsWithinDist2d(float x, float y, float dist2compare) const;
diff --git a/src/game/ScriptMgr.cpp b/src/game/ScriptMgr.cpp
index 7ba41fb..0dc4cfd 100644
--- a/src/game/ScriptMgr.cpp
+++ b/src/game/ScriptMgr.cpp
@@ -1231,7 +1231,7 @@ void ScriptAction::HandleScriptStep()
break;
uint32 creatureEntry = m_script->killCredit.creatureEntry;
- WorldObject* pRewardSource = pSource && pSource->GetTypeId() == TYPEID_UNIT ? pSource : (pTarget && pTarget->GetTypeId() == TYPEID_UNIT ? pTarget : NULL);
+ WorldObject* pRewardSource = pSource? pSource : (pTarget ? pTarget : NULL);
// dynamic effect, take entry of reward Source
if (!creatureEntry)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment