NullPointerException on list.add

前端 未结 3 796
广开言路
广开言路 2021-01-01 11:10

I am getting a NullPointerException at the modelData.add(i, es) method. I know from debugging that es isn\'t null. I\'m r

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-01 11:28

    On the first look, seems like modelData has not been instantiated. I would instantiate the modelData like:

    protected List modelData = new ArrayList();
    

    FYI.. In Java 7 there will be a new syntax you can use- someObject?.doSomething();

提交回复
热议问题