safer iteration over list elements

This commit is contained in:
adam-m 2012-01-20 10:27:26 -05:00
parent 6dd655941d
commit 1370a2db98
2 changed files with 6 additions and 4 deletions

View File

@ -523,10 +523,11 @@ public final class KeywordSearchListImportExportTopComponent extends TopComponen
TableEntry entry = null;
//iterate until row
Iterator<TableEntry> it = listData.iterator();
for (int i = 0; i <= rowIndex; ++i) {
for (int i = 0; i <= rowIndex && it.hasNext(); ++i) {
entry = it.next();
}
entry.isActive = (Boolean) aValue;
if (entry != null)
entry.isActive = (Boolean) aValue;
initButtons();
}

View File

@ -836,10 +836,11 @@ public final class KeywordSearchListTopComponent extends TopComponent implements
TableEntry entry = null;
//iterate until row
Iterator<TableEntry> it = keywordData.iterator();
for (int i = 0; i <= rowIndex; ++i) {
for (int i = 0; i <= rowIndex && it.hasNext(); ++i) {
entry = it.next();
}
entry.isActive = (Boolean) aValue;
if (entry != null)
entry.isActive = (Boolean) aValue;
if (getSelectedKeywords().isEmpty()) {
deleteWordButton.setEnabled(false);
} else {