Stupid stupid stupid. JComboBox.removeAllItems() NullExceptions if

there's a zero count. The safe way to call it is by:

if (combobox.getItemCount() > 0) {
  combobox.removeAllItems();
}

This is stupid.
This commit is contained in:
grail%cafebabe.org 1999-01-20 09:53:28 +00:00
parent 60a1c9c1c5
commit 834458b4fa

View File

@ -64,8 +64,12 @@ public class FolderCombo extends JComboBox {
ViewedStore stores[] = StoreFactory.Instance().getStores();
fInclude = aInclude;
fExclude = aExclude;
removeAllItems();
// this hack is getting old. why do i need it in the first place?
// this sucks!
if (getItemCount() > 0) {
removeAllItems();
}
try {
for (int i = 0; i < stores.length; i++) {