File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -1270,6 +1270,11 @@ class BinaryOpExpr : public Expression {
12701270          }
12711271
12721272          auto  r = right->evaluate (context);
1273+           if  (op != Op::Eq && op != Op::Ne) {
1274+             if  (r.is_null () || (l.is_null () && (op != Op::In && op != Op::NotIn))) {
1275+               throw  std::runtime_error (" unsupported operand type(s)"  );
1276+             }
1277+           }
12731278          switch  (op) {
12741279              case  Op::StrConcat: return  l.to_str () + r.to_str ();
12751280              case  Op::Add:       return  l + r;
@@ -2147,11 +2152,11 @@ class Parser {
21472152    }
21482153
21492154    std::runtime_error unexpected (const  TemplateToken & token) const  {
2150-       return  std::runtime_error (" Unexpected  "   + TemplateToken::typeToString (token.type )
2155+       return  std::runtime_error (" Encountered unknown tag ' "   + TemplateToken::typeToString (token.type ) +  " ' " 
21512156        + error_location_suffix (*template_str, token.location .pos ));
21522157    }
21532158    std::runtime_error unterminated (const  TemplateToken & token) const  {
2154-       return  std::runtime_error (" Unterminated  "   + TemplateToken::typeToString (token.type )
2159+       return  std::runtime_error (" Unexpected end of template. Jinja was looking for the following tags: ' "   + TemplateToken::typeToString (token.type ) +  " ' " 
21552160        + error_location_suffix (*template_str, token.location .pos ));
21562161    }
21572162
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments