Permalink
Browse files

taking care against zero-length sensor arrays

  • Loading branch information...
1 parent 4430d43 commit 265143c7eccc93ac0da1595e51ad36c7413f9036 @rtv committed Jan 12, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 libstageplugin/p_ranger.cc
@@ -71,11 +71,11 @@ void InterfaceRanger::Publish( void )
if( sensors.size() == 1 ) // a laser scanner type, with one beam origin and many ranges
{
- prange.ranges = &sensors[0].ranges[0];
prange.ranges_count = sensors[0].ranges.size();
+ prange.ranges = prange.ranges_count ? &sensors[0].ranges[0] : NULL;
- pintens.intensities = &sensors[0].intensities[0];
- pintens.intensities_count = sensors[0].intensities.size();
+ pintens.intensities_count = sensors[0].intensities.size();
+ pintens.intensities = pintens.intensities_count ? &sensors[0].intensities[0] : NULL;
}
else
{ // a sonar/IR type with one range per beam origin

0 comments on commit 265143c

Please sign in to comment.