Skip to content

Commit

Permalink
Merge pull request #412 from agri-gaia/imageconversion
Browse files Browse the repository at this point in the history
check if image data is not empty
  • Loading branch information
Mark-Niemeyer committed Sep 3, 2024
2 parents 81cd1a4 + 746166e commit f92f924
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,14 @@ sensor_msgs::Image toROS(const seerep::fb::Image& image)
ret.encoding = image.encoding()->str();
ret.is_bigendian = image.is_bigendian();
ret.step = image.step();
ret.data.reserve(image.data()->size());

std::copy_n(image.data()->Data(), image.data()->size(),
std::back_inserter(ret.data));
// check if data is included (cf. query "withoutData")
if (image.data() != 0)
{
ret.data.reserve(image.data()->size());
std::copy_n(image.data()->Data(), image.data()->size(),
std::back_inserter(ret.data));
}
return ret;
}

Expand Down

0 comments on commit f92f924

Please sign in to comment.