Fix the error when no devices were connected.