Skip to content

Commit

Permalink
PR IntelRealSense#31 from Nir: Fix exception on non supported CAH dev…
Browse files Browse the repository at this point in the history
…ices
  • Loading branch information
maloel authored Jul 20, 2020
2 parents 29dcb92 + ec80292 commit 0184bd0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
21 changes: 16 additions & 5 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3377,9 +3377,13 @@ namespace rs2
syncer(viewer.syncer),
_update_readonly_options_timer(std::chrono::seconds(6))
, _detected_objects(std::make_shared< atomic_objects_in_frame >()),
_updates(viewer.updates),
_accuracy_health_model(*this, viewer)
_updates(viewer.updates)
{
if (dev.is<device_calibration>())
{
_accuracy_health_model = std::unique_ptr<cah_model>(new cah_model(*this, viewer));
}

auto name = get_device_name(dev);
id = to_string() << name.first << ", " << name.second;

Expand Down Expand Up @@ -4787,7 +4791,8 @@ namespace rs2
}


if (dev.supports(RS2_CAMERA_INFO_PRODUCT_LINE) && dev.supports(RS2_CAMERA_INFO_FIRMWARE_VERSION))
if (dev.supports(RS2_CAMERA_INFO_PRODUCT_LINE) && dev.supports(RS2_CAMERA_INFO_FIRMWARE_VERSION) &&
dev.is<device_calibration>())
{
auto product_line_str = dev.get_info(RS2_CAMERA_INFO_PRODUCT_LINE);
if (RS2_PRODUCT_LINE_L500 == parse_product_line(product_line_str))
Expand Down Expand Up @@ -4973,12 +4978,18 @@ namespace rs2

if (show_trigger_camera_accuracy_health_popup)
{
show_trigger_camera_accuracy_health_popup = _accuracy_health_model.prompt_trigger_popup(window, error_message);
if (_accuracy_health_model)
{
show_trigger_camera_accuracy_health_popup = _accuracy_health_model->prompt_trigger_popup(window, error_message);
}
}

if (show_reset_camera_accuracy_health_popup)
{
show_reset_camera_accuracy_health_popup = _accuracy_health_model.prompt_reset_popup(window, error_message);
if (_accuracy_health_model)
{
show_reset_camera_accuracy_health_popup = _accuracy_health_model->prompt_reset_popup(window, error_message);
}
}

if (keep_showing_advanced_mode_modal)
Expand Down
2 changes: 1 addition & 1 deletion common/model-views.h
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ namespace rs2
// Needed as a member for reseting the window memory on device disconnection.


cah_model _accuracy_health_model;
std::unique_ptr<cah_model> _accuracy_health_model;
void draw_info_icon(ux_window& window, ImFont* font, const ImVec2& size);
int draw_seek_bar();
int draw_playback_controls(ux_window& window, ImFont* font, viewer_model& view);
Expand Down

0 comments on commit 0184bd0

Please sign in to comment.