If there is no legal target for Snapdax’s triggered ability when it triggers, it won’t be put onto the stack at all and you won’t gain 4 life. Similarly, if the target creature or planeswalker is an illegal target by the time the ability tries to resolve, the ability won’t resolve and you won’t gain 4 life.