Not really?

Simple boolean logic. If that target is dead before the spell is cast, switch to another target.

The problem is which one? What if its a mob you're NOT trying to attack because it's asleep?