diff --git a/src/ds/d500/d500-color.cpp b/src/ds/d500/d500-color.cpp index 0d49268020..a9ccf23af8 100644 --- a/src/ds/d500/d500-color.cpp +++ b/src/ds/d500/d500-color.cpp @@ -63,6 +63,11 @@ namespace librealsense std::vector color_devs_info = filter_by_mi(group.uvc_devices, 3); + if ( color_devs_info.empty() ) + { + throw backend_exception("cannot access color sensor", RS2_EXCEPTION_TYPE_BACKEND); + } + std::unique_ptr< frame_timestamp_reader > ds_timestamp_reader_backup( new ds_timestamp_reader() ); std::unique_ptr ds_timestamp_reader_metadata(new ds_timestamp_reader_from_metadata(std::move(ds_timestamp_reader_backup))); diff --git a/src/ds/d500/d500-device.cpp b/src/ds/d500/d500-device.cpp index 9c38d0aeeb..faed9c8e7c 100644 --- a/src/ds/d500/d500-device.cpp +++ b/src/ds/d500/d500-device.cpp @@ -341,7 +341,14 @@ namespace librealsense using namespace ds; std::vector> depth_devices; - for( auto & info : filter_by_mi( all_device_infos, 0 ) ) // Filter just mi=0, DEPTH + auto depth_devs_info = filter_by_mi( all_device_infos, 0 ); + + if ( depth_devs_info.empty() ) + { + throw backend_exception("cannot access depth sensor", RS2_EXCEPTION_TYPE_BACKEND); + } + + for( auto & info : depth_devs_info ) // Filter just mi=0, DEPTH depth_devices.push_back( get_backend()->create_uvc_device( info ) ); std::unique_ptr< frame_timestamp_reader > timestamp_reader_backup( new ds_timestamp_reader() );