guard against infinite loop when expanding live template (IDEADEV-41789) [r=max]

This commit is contained in:
Dmitry Jemerov
2009-12-02 17:28:27 +03:00
parent 99f5c5ca46
commit 255b09d206
@@ -536,8 +536,10 @@ public class TemplateState implements Disposable {
new Runnable() {
public void run() {
BitSet calcedSegments = new BitSet();
int maxAttempts = (myTemplate.getVariableCount()+1)*3;
do {
maxAttempts--;
calcedSegments.clear();
for (int i = myCurrentVariableNumber + 1; i < myTemplate.getVariableCount(); i++) {
String variableName = myTemplate.getVariableNameAt(i);
@@ -565,7 +567,7 @@ public class TemplateState implements Disposable {
}
}
}
while (!calcedSegments.isEmpty());
while (!calcedSegments.isEmpty() && maxAttempts >= 0);
}
}
);