Thread: Null exception
View Single Post
  #4  
Old 03-13-2012, 08:46 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

For me it seems the error is in
Code:
 private void damageAiControlledPlane(AiActor actorMain)
    {        
        foreach (AiActor actor in actorMain.Group().GetItems())
        {
            if (actor == null || !(actor is AiAircraft))
                return;
            AiAircraft aircraft = (actor as AiAircraft);
            if (!isAiControlledPlane(aircraft))
                return;
            if (aircraft == null)
                return;
            (actor as AiAircraft).Destroy();             
        }
    }
Why you use the Group to destroy a single Airplane? Do you test the Group for null value? It make no sense to me to use the Group in this case.
Reply With Quote