-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot access a property or method of a null object reference at zpp_nape.space::ZPP_Space/presteparb() #74
Comments
I've been getting the same error as this using nape with citrus. The error output isn't really useful in determining the problem. Since this was posted awhile back, I'm just curious if you managed to resolve the issue? I was creating and object pool and initializing with 10 items. In a loop I was disposing all the items before getting them back from the pool and assigning them x and y positions on the display. The error seemed to occur randomly, sometimes a day or two into running the application. |
Very cool library!, unfortunately I am also getting this issue. It happens under consistent conditions so not randomly but the cause is not obvious to me so very difficult to perform work arounds. In my situation, I see it at some point after manually updating the body position/velocity in very specific repeatable conditions. |
I am also seeing this error. Could anybody give some insight on what could cause it? I am indeed setting body velocity but I never get any issues in testing, or on my own device nor has anybody I know.. |
I had this issue because I was manually iterating through a body's arbiters. It turns out that an invalid arbiter could totally be in the body's list, and that caused the issue for me. Instead of using a for loop to go through the arbiters, I had to change it to look like how ArbiterList does it. IIRC it's a while loop and a try catch statement. The catch is for when the arbiter is invalid. May not fix your issues, but it totally fixed my similar ones. |
Thank you @MSGhero for your feedback! I am indeed also doing some stuff with the arbiters, will try/catch. :) |
Here's how I did it. var collision = false;
var it = agent.body.arbiters.iterator();
while (it.hasNext()) {
try {
collision = checkCollision(it.next()) || collision;
}
catch(e:Dynamic) { // I wonder if this "solves" the issue
it.zpp_next=ArbiterIterator.zpp_pool;
ArbiterIterator.zpp_pool=it;
it.zpp_inner=null;
break;
}
} |
I have try/catched arbiters, stopped changing velocity values but I am still getting these errors. @deltaluca could you please give us some input on this issue? |
a simple reproducible would be ideal of course since I haven't even looked at the nape source for a few years now, so my contextual knowledge is very low at this point. |
Hey @deltaluca, I haven't got a reproductible case yet, but I checked the "context" of the latest errors we logged and in all cases I am adding entities to the space. Is there a best practice for adding new bodies to a space at certain coordinates that could overlap other bodies? |
I no longer get this error.
|
Thanks for your insight @sumowrestler. On my side it's not try/catched nor do I used the space.liveBodes.forEach function :/ |
Hi @deltaluca As explained in comments, it's a 1009 error from zpp_nape/Space.cx line 2251: callbackset.remove_arb(arb); (callbackset is null). |
Main problem - this exception appears quite randomly (several seconds to several minutes from the start if it appears, no matter what you do). So it is hard to understand what is causing it.
Because i have no idea where is our problem i'll just give details:
Error Message:
Our project specifics:
We are using citrus+starling+nape (as3).
Nape space contains destructible terrain (based on nape's sample "DestructibleTerrain" with marching squares), static terrain, another static body as some sort of "lava", several body compounds as "tanks".
Also there is a second nape space but it does nothing when error occurs (no "nape.step" calls for it are ever done).
Libraries info
citrus engine v. 3.1.7
nape v. 2.0.9 (Development build). Tried in 2.0.12 and Release/Debug builds - still happens with the same error message.
The text was updated successfully, but these errors were encountered: