Fixed an infinite loop that happened if the camera is not connected.