From 41e1c4a64eb37afb90ca3cc53fdae9082504149b Mon Sep 17 00:00:00 2001 From: bohdan-harniuk Date: Wed, 15 Dec 2021 23:22:27 +0200 Subject: [PATCH] 810: Fixed StringIndexOutOfBoundsException during UCT inspection via action execution --- .../idea/magento2uct/util/php/MagentoTypeEscapeUtil.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/com/magento/idea/magento2uct/util/php/MagentoTypeEscapeUtil.java b/src/com/magento/idea/magento2uct/util/php/MagentoTypeEscapeUtil.java index 7f6d37b84..ce910cea9 100644 --- a/src/com/magento/idea/magento2uct/util/php/MagentoTypeEscapeUtil.java +++ b/src/com/magento/idea/magento2uct/util/php/MagentoTypeEscapeUtil.java @@ -32,7 +32,13 @@ private MagentoTypeEscapeUtil() { String result = typeFqn; while (matcher.find()) { - result = result.substring(0, matcher.start(0)) + result.substring(matcher.end(0)); + final int begin = matcher.start(0); + final int end = matcher.end(0); + + if (begin < 0 || begin > end || end > result.length()) { + continue; + } + result = result.substring(0, begin) + result.substring(end); } return typeFqn.equals(result) ? typeFqn : result;