mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-12 07:19:50 +08:00
fixed maybe crash #60
This commit is contained in:
@@ -1383,6 +1383,10 @@ void OBCameraNode::publishDepthPointCloud(const std::shared_ptr<ob::FrameSet> &f
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::lock_guard<decltype(point_cloud_mutex_)> point_cloud_msg_lock(point_cloud_mutex_);
|
std::lock_guard<decltype(point_cloud_mutex_)> point_cloud_msg_lock(point_cloud_mutex_);
|
||||||
|
if(!depth_frame_) {
|
||||||
|
RCLCPP_ERROR_STREAM(logger_, "depth frame is null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
auto depth_frame = depth_frame_->as<ob::DepthFrame>();
|
auto depth_frame = depth_frame_->as<ob::DepthFrame>();
|
||||||
if (!depth_frame) {
|
if (!depth_frame) {
|
||||||
RCLCPP_ERROR_STREAM(logger_, "depth frame is null");
|
RCLCPP_ERROR_STREAM(logger_, "depth frame is null");
|
||||||
@@ -1482,6 +1486,10 @@ void OBCameraNode::publishColoredPointCloud(const std::shared_ptr<ob::FrameSet>
|
|||||||
|
|
||||||
CHECK_NOTNULL(depth_frame_.get());
|
CHECK_NOTNULL(depth_frame_.get());
|
||||||
std::lock_guard<decltype(point_cloud_mutex_)> point_cloud_msg_lock(point_cloud_mutex_);
|
std::lock_guard<decltype(point_cloud_mutex_)> point_cloud_msg_lock(point_cloud_mutex_);
|
||||||
|
if (!depth_frame_) {
|
||||||
|
RCLCPP_ERROR_STREAM(logger_, "depth frame is null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
auto depth_frame = depth_frame_->as<ob::DepthFrame>();
|
auto depth_frame = depth_frame_->as<ob::DepthFrame>();
|
||||||
auto color_frame = frame_set->colorFrame();
|
auto color_frame = frame_set->colorFrame();
|
||||||
if (!depth_frame || !color_frame) {
|
if (!depth_frame || !color_frame) {
|
||||||
|
|||||||
Reference in New Issue
Block a user