throw new FitsException("Attempt to delete non-existent HDU:" + n);
}
try {
hduList.removeElementAt(n);
if (n == 0 && size > 1) {
BasicHDU newFirst = (BasicHDU) hduList.elementAt(0);
if (newFirst.canBePrimary()) {
newFirst.setPrimaryHDU(true);
} else {
insertHDU(BasicHDU.getDummyHDU(), 0);
}
}
} catch (NoSuchElementException e) {