fixed out of bounds exc

This commit is contained in:
bancika
2012-03-04 14:27:10 +00:00
parent e572412f1e
commit 4f113f032d
@@ -261,13 +261,15 @@ public class StatusBar extends JPanel implements IPlugIn {
statusText = "<html>Drag control point(s) of " + formattedNames + "</html>"; statusText = "<html>Drag control point(s) of " + formattedNames + "</html>";
} else if (selectedComponentNames != null && !selectedComponentNames.isEmpty()) { } else if (selectedComponentNames != null && !selectedComponentNames.isEmpty()) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append(Utils.toCommaString(selectedComponentNames.subList(0, 20))); builder.append(Utils.toCommaString(selectedComponentNames.subList(0, Math.min(20,
selectedComponentNames.size()))));
if (selectedComponentNames.size() > 20) { if (selectedComponentNames.size() > 20) {
builder.append(" and " + (selectedComponentNames.size() - 20) + " more"); builder.append(" and " + (selectedComponentNames.size() - 20) + " more");
} }
if (!stuckComponentNames.isEmpty()) { if (!stuckComponentNames.isEmpty()) {
builder.append(" (hold <b>Ctrl</b> and drag to unstuck from "); builder.append(" (hold <b>Ctrl</b> and drag to unstuck from ");
builder.append(Utils.toCommaString(stuckComponentNames.subList(0, 5))); builder.append(Utils.toCommaString(stuckComponentNames.subList(0, Math.min(5,
stuckComponentNames.size()))));
if (stuckComponentNames.size() > 5) { if (stuckComponentNames.size() > 5) {
builder.append(" and " + (stuckComponentNames.size() - 5) + " more"); builder.append(" and " + (stuckComponentNames.size() - 5) + " more");
} }