From ca0e86350215f2b4fb18bdf9f10ef1e7e18269cc Mon Sep 17 00:00:00 2001 From: Jules Fouchy Date: Sat, 12 Aug 2023 22:31:23 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Handle=20errors=20on=20MacOS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/webcam_info.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/webcam_info.mm b/src/webcam_info.mm index 2d37549..a0eabe1 100644 --- a/src/webcam_info.mm +++ b/src/webcam_info.mm @@ -17,11 +17,15 @@ auto grab_all_webcams_infos_impl() -> std::vector { mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionUnspecified]; + if (!discoverySession) { + return list_webcams_infos; + } + NSArray *devices = discoverySession.devices; for (AVCaptureDevice *device in devices) { @autoreleasepool { - std::string deviceName = [device.localizedName UTF8String]; + std::string deviceName = [[device localizedName] UTF8String]; std::vector list_resolution{}; for (AVCaptureDeviceFormat *format in device.formats) {