Skip to content

Commit

Permalink
Fix crash on multi-component bodies. opencog#852
Browse files Browse the repository at this point in the history
Patterns with multiple components may fail to ground one of
the parts; this is normal and is handled up-stream.
  • Loading branch information
linas committed Aug 4, 2016
1 parent 8ab7ed7 commit d735202
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion opencog/query/Satisfier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,19 @@ bool Satisfier::search_finished(bool done)
// If there were no variables to be grounded, we have nothing to do.
if (not _have_variables) return done;

// If there was a grounding, then don't don't re-run; we're here
// If there was a grounding, then don't re-run; we're here
// only to handle the no-groundings case.
if (TruthValue::TRUE_TV() == _result) return done;

// _optionals_present will be set to true if some optional clause
// was grounded. Ergo, its not the no-grounding case.
if (_optionals_present) return done;

// Multi-component patterns will not have distinct bodies.
// A failure to match one of the components is benign, and is
// treated appropriately upstream. Just return.
if (nullptr == _pattern_body) return done;

// Evaluating the pattern body only makes sense if it is sequential
// (ordered) -- if the body is an unordered AndLink, or if its a
// ChoiceLink, etc, this makes no sense.
Expand Down

0 comments on commit d735202

Please sign in to comment.