Skip to content

Commit 495e428

Browse files
authored
Merge pull request #852 from bohdan-harniuk/810-fixed-StringIndexOutOfBoundsException-for-uct-run
810: Fixed StringIndexOutOfBoundsException during UCT inspection via action execution
2 parents a2d1306 + 41e1c4a commit 495e428

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/com/magento/idea/magento2uct/util/php/MagentoTypeEscapeUtil.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@ private MagentoTypeEscapeUtil() {
3232
String result = typeFqn;
3333

3434
while (matcher.find()) {
35-
result = result.substring(0, matcher.start(0)) + result.substring(matcher.end(0));
35+
final int begin = matcher.start(0);
36+
final int end = matcher.end(0);
37+
38+
if (begin < 0 || begin > end || end > result.length()) {
39+
continue;
40+
}
41+
result = result.substring(0, begin) + result.substring(end);
3642
}
3743

3844
return typeFqn.equals(result) ? typeFqn : result;

0 commit comments

Comments
 (0)