Allow ctrl-d out of the prompt for devices

Currently this will segfault fwupdmgr

Choose a device:
1.	8a21cacfb0a8d2b30c5ee9290eb71db021619f8b (XPS 13 9370 System Firmware)
2.	cb52b4cd86255a70d1d9e6b09c6bf00b9f876b61 (XPS 9370 Thunderbolt Controller)
<ctrl-d>

Thread 1 "fwupdmgr" received signal SIGSEGV, Segmentation fault.
fu_util_prompt_for_device (priv=<optimized out>, error=<optimized out>) at ../src/fu-util.c:315
315		return g_object_ref (dev);
This commit is contained in:
Mario Limonciello 2018-02-28 10:14:15 -06:00 committed by Mario Limonciello
parent 2d8f2455c9
commit 80d1a294d1

View File

@ -311,6 +311,13 @@ fu_util_prompt_for_device (FuUtilPrivate *priv, GError **error)
fwupd_device_get_name (dev));
}
idx = fu_util_prompt_for_number (devices_filtered->len);
if (idx == 0) {
g_set_error_literal (error,
FWUPD_ERROR,
FWUPD_ERROR_NOTHING_TO_DO,
"Request canceled");
return NULL;
}
dev = g_ptr_array_index (devices_filtered, idx - 1);
return g_object_ref (dev);
}