Permalink
Browse files

Empty targets are also a problem for the substructure search. Simple …

…checks avoids the infinite loop.

Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information...
1 parent c1f7b2d commit d9ef27faccddb1d1ffd14d4bf272478c1f32ff08 @johnmay johnmay committed with egonw Feb 13, 2014
@@ -61,7 +61,8 @@
StateStream(final State state) {
this.state = state;
this.stack = new CandidateStack(state.nMax());
- this.next = state.nMax() == 0 ? null : findNext(); // first-mapping
+ this.next = state.nMax() == 0 || state.mMax() == 0 ? null
+ : findNext(); // first-mapping
}
/** @inheritDoc */
@@ -331,6 +331,11 @@
assertMismatch(smi(""),
smi("[H][H]"));
}
+
+ @Test public void emptyTarget() throws Exception {
+ assertMismatch(smi("[H][H]"),
+ smi(""));
+ }
void assertMatch(IAtomContainer query, IAtomContainer target, int count) {
assertThat(query.getProperty(TITLE)

0 comments on commit d9ef27f

Please sign in to comment.