Fix segfault when no devices are presents