package skadistats.clarity.parser.handler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import skadistats.clarity.match.Match;
import skadistats.clarity.model.UserMessage;
import skadistats.clarity.parser.Handler;
import skadistats.clarity.parser.HandlerHelper;
import skadistats.clarity.parser.RegisterHandler;

import com.dota2.proto.DotaUsermessages.CDOTAUserMsg_DodgeTrackingProjectiles;

@RegisterHandler(CDOTAUserMsg_DodgeTrackingProjectiles.class)
public class UserMsgDodgeTrackingProjectilesHandler implements Handler<CDOTAUserMsg_DodgeTrackingProjectiles> {

    private final Logger log = LoggerFactory.getLogger(getClass());
    
    @Override
    public void apply(int peekTick, CDOTAUserMsg_DodgeTrackingProjectiles message, Match match) {
        HandlerHelper.traceMessage(log, peekTick, message);
        log.debug("{} DODGE_TRACKING_PROJECTILES [target={}]",
            match.getReplayTimeAsString(),
            match.getEntities().getByIndex(message.getEntindex()).getDtClass().getDtName() 
        );
        match.getUserMessages().add(UserMessage.build(message, match));
    }

}

package skadistats.clarity.parser.handler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import skadistats.clarity.match.Match;
import skadistats.clarity.model.UserMessage;
import skadistats.clarity.parser.Handler;
import skadistats.clarity.parser.HandlerHelper;
import skadistats.clarity.parser.RegisterHandler;

import com.dota2.proto.DotaUsermessages.CDOTAUserMsg_DodgeTrackingProjectiles;

@RegisterHandler(CDOTAUserMsg_DodgeTrackingProjectiles.class)
public class UserMsgDodgeTrackingProjectilesHandler implements Handler<CDOTAUserMsg_DodgeTrackingProjectiles> {

    private final Logger log = LoggerFactory.getLogger(getClass());
    
    @Override
    public void apply(int peekTick, CDOTAUserMsg_DodgeTrackingProjectiles message, Match match) {
        HandlerHelper.traceMessage(log, peekTick, message);
        log.debug("{} DODGE_TRACKING_PROJECTILES [target_index={}]",
            match.getReplayTimeAsString(),
            message.getEntindex()
        );
        match.getUserMessages().add(UserMessage.build(message, match));
    }

}

Fix NullPointerException when referencing an already deleted ent
Fix NullPointerException when referencing an already deleted ent

NullPointerExceptions could happen when logging a debug message
related to an entity that has already been removed from the
EntityCollection.
