Author Topic: Add object to world exception  (Read 2064 times)

Offline gamenewer

  • long
  • ***
  • Posts: 171
    • View Profile
Add object to world exception
« on: March 02, 2015, 05:44:12 am »
Hellow Egon, I  add objects to world , but sometimes get error

03-02 12:39:44.920: E/AndroidRuntime(5259): FATAL EXCEPTION: GLThread 13
03-02 12:39:44.920: E/AndroidRuntime(5259): java.lang.NullPointerException
03-02 12:39:44.920: E/AndroidRuntime(5259):    at com.threed.jpct.Object3DList.contains(Object3DList.java:83)
03-02 12:39:44.920: E/AndroidRuntime(5259):    at com.threed.jpct.World.addObject(World.java:325)

not always ,sometimes is ok ,but some times is error .   

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Add object to world exception
« Reply #1 on: March 02, 2015, 07:44:37 am »
This can only happen if one of the objects in the list is null. This can either happen if you are adding null objects or you are adding and removing objects in different threads. jPCT-AE isn't thread safe. Don't add/remove any objects from outside the rendering thread: http://www.jpct.net/wiki/index.php/Thread_safety

Offline gamenewer

  • long
  • ***
  • Posts: 171
    • View Profile
Re: Add object to world exception
« Reply #2 on: March 02, 2015, 01:46:05 pm »
Oh, Thanks very much ! :)