diff --git a/orm_lib/src/Criteria.cc b/orm_lib/src/Criteria.cc index 8840a8f6..222502df 100644 --- a/orm_lib/src/Criteria.cc +++ b/orm_lib/src/Criteria.cc @@ -21,8 +21,16 @@ namespace orm { const Criteria operator&&(Criteria cond1, Criteria cond2) { - assert(cond1); - assert(cond2); + bool cond1valid = (bool)cond1, cond2valid = (bool)cond2; + assert(cond1valid || cond2valid); + if (cond1valid && !cond2valid) + { + return cond1; + } + if (!cond1valid && cond2valid) + { + return cond2; + } Criteria cond; cond.conditionString_ = "( "; cond.conditionString_ += cond1.conditionString_; @@ -47,8 +55,16 @@ const Criteria operator&&(Criteria cond1, Criteria cond2) const Criteria operator||(Criteria cond1, Criteria cond2) { - assert(cond1); - assert(cond2); + bool cond1valid = (bool)cond1, cond2valid = (bool)cond2; + assert(cond1valid || cond2valid); + if (cond1valid && !cond2valid) + { + return cond1; + } + if (!cond1valid && cond2valid) + { + return cond2; + } Criteria cond; cond.conditionString_ = "( "; cond.conditionString_ += cond1.conditionString_;