From bcdd2a82a0154f8c406dadd451e61c08a27c7b34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Locker?= Date: Fri, 17 May 2024 00:39:43 +0200 Subject: [PATCH] Avoid IndexOutOfBoundsException in lhsUnary --- .../java/org/drools/drl/parser/antlr4/DRLVisitorImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/antlr4/DRLVisitorImpl.java b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/antlr4/DRLVisitorImpl.java index 7001beed648..485928d6e7a 100644 --- a/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/antlr4/DRLVisitorImpl.java +++ b/drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/antlr4/DRLVisitorImpl.java @@ -1087,9 +1087,10 @@ public BaseDescr visitLhsUnary(DRLParser.LhsUnaryContext ctx) { .build(); children.forEach(andDescr::addDescr); return andDescr; - } else { - // size == 1. children never be empty + } else if (children.size() == 1) { return children.get(0); + } else { + return null; // only caused by a parser error } }