From 88f658dfc71f3b1065904ff28802396df76c11ac Mon Sep 17 00:00:00 2001 From: Dadoum Date: Sat, 28 Oct 2023 01:01:07 +0200 Subject: [PATCH] Don't show any error dialog when no device are connected --- source/imobiledevice/package.d | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/imobiledevice/package.d b/source/imobiledevice/package.d index bcb6349..083bac0 100644 --- a/source/imobiledevice/package.d +++ b/source/imobiledevice/package.d @@ -81,7 +81,11 @@ public class iDevice { public static @property iDeviceInfo[] deviceList() { int len; idevice_info_t* names; - idevice_get_device_list_extended(&names, &len).assertSuccess(); + auto res = idevice_get_device_list_extended(&names, &len); + if (res == idevice_error_t.IDEVICE_E_NO_DEVICE) { + return []; + } + res.assertSuccess(); return names[0..len].map!((s) => iDeviceInfo(cast(string) s.udid.fromStringz, cast(iDeviceConnectionType) s.conn_type)).array; }