moving an object on a specific direction

I have a homing missle, that’s slerping towards it’s target and I’m trying to get that missle to keep going straight on it’s last known direction, should the target die while the missle is in flight.

During the slerp, I noticed the missle does not rotate, it simple translates (local axis forward is always facing the same way regardless of which direction the missle is headed)

So all I’m trying to do is keep the object moving in it’s last known direction, if their is no target. Is their anyway to grab that direction it’s heading while it’s in the slerp?

I thought it might be something like;

if (target == null)
		{
			targetDirection = transform.position;
			
			transform.Translate(targetDirection * Time.deltaTime * moveSpeed);	
		}

But that isn’t working at all.

Stop updating targetDirection when target becomes null.