Skip to content

Commit

Permalink
Fix crash in data association
Browse files Browse the repository at this point in the history
Fix potential crash in mrpt::slam::data_association_full_covariance with
JCBB when no individually compatible matching exists
  • Loading branch information
jlblancoc committed Jun 14, 2014
1 parent 6877f5e commit 482472e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/doxygen-pages/changeLog_doc.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
- RawLogViewer: Operation "convert to SF format" didn't take into account odometry observations.
- Fix build errors with GCC 4.9
- Fix crash of mrpt::hwdrivers::CIMUXSens_MT4's destructor when it fails to scan and open a device.
- Fix potential crash in mrpt::slam::data_association_full_covariance with JCBB when no individually compatible matching exists [(commit)]()
<hr>
<a name="1.1.0">
Expand Down
3 changes: 2 additions & 1 deletion libs/slam/src/slam/data_association.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ double joint_pdf_metric (
{
// Make a list of the indices of the predictions that appear in "currentAssociation":
const size_t N = info.currentAssociation.size();
ASSERT_(N>0)

vector_size_t indices_pred(N); // Appearance order indices in the std::maps
vector_size_t indices_obs(N);
Expand Down Expand Up @@ -166,7 +167,7 @@ void JCBB_recursive(
info,
results);
}
else if ( info.currentAssociation.size()==results.associations.size() )
else if ( !info.currentAssociation.empty() && info.currentAssociation.size()==results.associations.size() )
{
// The same # of features matched than the previous best one... decide by better distance:
const double d2 = joint_pdf_metric<T,METRIC>(
Expand Down

0 comments on commit 482472e

Please sign in to comment.