Scripts/Shadowmoon Valley: Fix static analysis issues added in cd48ee01c0
Fix static analysis issues added in cd48ee01c0 about uninitialized values and pointers possibly point to free'd memory being dereferenced.
In memory of all the developers who got banned from IRC in the process of fixing these issues.
This commit is contained in:
1 parent
31234c0ca0
commit
b71f8367e4
1 file changed
+7
-4
@@ -71,7 +71,10 @@ public:
|
||||
|
||||
struct npc_invis_infernal_casterAI : public ScriptedAI
|
||||
{
|
||||
npc_invis_infernal_casterAI(Creature* creature) : ScriptedAI(creature) { }
|
||||
npc_invis_infernal_casterAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
ground = 0.f;
|
||||
}
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
@@ -148,12 +151,12 @@ public:
|
||||
void IsSummonedBy(Unit* summoner) override
|
||||
{
|
||||
if (summoner->ToCreature())
|
||||
caster = summoner->ToCreature();
|
||||
casterGUID = summoner->ToCreature()->GetGUID();;
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
if (caster)
|
||||
if (Creature* caster = ObjectAccessor::GetCreature(*me, casterGUID))
|
||||
caster->AI()->SetData(TYPE_INFERNAL, DATA_DIED);
|
||||
}
|
||||
|
||||
@@ -175,7 +178,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
Creature* caster;
|
||||
ObjectGuid casterGUID;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
|
||||
Reference in new issue
Block a user