www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: gamenewer on March 02, 2015, 05:44:12 am

Title: Add object to world exception
Post by: gamenewer 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 .   
Title: Re: Add object to world exception
Post by: EgonOlsen 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 (http://www.jpct.net/wiki/index.php/Thread_safety)
Title: Re: Add object to world exception
Post by: gamenewer on March 02, 2015, 01:46:05 pm
Oh, Thanks very much ! :)