Detecting a joystick disconnect

Is there a way to detect when a joystick has been disconnected in SDL
1.2 or 1.3?

-Brad