[ms] fix an infinite loop in ms planner and another crash
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 22 Oct 2010 17:38:47 +0200
changeset 6598 78eaccfbd2b7
parent 6597 ba9fb496ad87
child 6599 d3008cb6d1c3
[ms] fix an infinite loop in ms planner and another crash
server/msplanner.py
--- a/server/msplanner.py	Fri Oct 22 17:10:31 2010 +0200
+++ b/server/msplanner.py	Fri Oct 22 17:38:47 2010 +0200
@@ -1032,7 +1032,7 @@
         if isinstance(term, Relation) and term in cross_rels:
             cross_terms = cross_rels.pop(term)
             base_accept_term = accept_term
-            accept_term = lambda x: (accept_term(x) or x in cross_terms)
+            accept_term = lambda x: (base_accept_term(x) or x in cross_terms)
             for refed in cross_terms:
                 if not refed in candidates:
                     terms.append(refed)
@@ -1125,7 +1125,7 @@
     def build_final_part(self, select, solindices, inputmap,  sources,
                          insertedvars):
         solutions = [self._solutions[i] for i in solindices]
-        if self._conflicts:
+        if self._conflicts and inputmap:
             for varname, mappedto in self._conflicts:
                 var = select.defined_vars[varname]
                 newvar = select.make_variable()