#vulnerable code 
                                @Override
    public final Host setActive(final boolean activate) {
        if(isFailed() && activate){
            throw new IllegalStateException("The Host is failed and cannot be activated.");
        }

        notifyStartupOrShutdown(activate);

        if(activate && !this.active) {
            setStartTime(getSimulation().clock());
        } else if(!activate && this.active){
            setShutdownTime(getSimulation().clock());
        }

        this.active = activate;
        return this;
    } 
                            #location 12 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                @Override
    public final Host setActive(final boolean activate) {
        if(isFailed() && activate){
            throw new IllegalStateException("The Host is failed and cannot be activated.");
        }

        final boolean wasActive = this.active;

        if(activate && !this.active) {
            setStartTime(getSimulation().clock());
        } else if(!activate && this.active){
            setShutdownTime(getSimulation().clock());
        }

        this.active = activate;
        notifyStartupOrShutdown(activate, wasActive);
        return this;
    }