NullPointerException on list.add
2022-09-01 13:36:15
我正在得到一个在的方法。我从调试中知道这不是.我真的很困惑,谢谢。NullPointerException
modelData.add(i, es)
es
null
public class EventTableModel extends AbstractTableModel {
//private int rowCount = 0;
protected List<EventSeat> modelData;
private static final int COLUMN_COUNT = 3;
private Event e;
Event j = GUIpos.m;
int i = 1;
public EventTableModel(Event e) {
this.e = e;
try {
System.out.println(modelData);
for (EventSeat es : e.getEventSeats()) {
modelData.add(i, es);
i++;
}
} catch (DataException ex) {
Logger.getLogger(EventTableModel.class.getName()).log(Level.SEVERE, null, ex);
}
}