A bit more robust to do an **instanceof** check before you do the cast.