Cyberkilla, In Case You'll Ever Read This

Started by AGP, August 07, 2008, 06:13:01 PM

Previous topic - Next topic

AGP

I found out the location where most of the NullPointerException problems are happening: the method getChild(String) addressed as   XMLElement geometryElement = submesh.getChild("geometry");
on private static OGREVertexBuffer loadGeometry(XMLElement) is returning null! Don't know how to fix it yet, but if you don't come back soon I may have to do it myself! : -(

AGP

#1
The following is the code for getChild(String). The only scenario in which it would return null is if your XMLFactory returned an empty Vector. Anything you can tell me about it? Any problems in the past, or will I have to dig deeper and find out where that node comes from?

EDIT: I did dig further, and it all comes down to your XMLFactory.parseXML(String) method. I smell bug. :-) If you wouldn't mind, I could look at it for you.

public XMLElement getChild(String name) {
Vector nodes = XMLFactory.getInstance().getMatchingNodes(node.getName()+"/"+name,node);
if(nodes.size() == 0)
return null;

XMLNode newNode = (XMLNode)nodes.get(0);
return new XMLElement(newNode);
}

EgonOlsen

getMatchingNodes() can never return null. If creates a Vector, tries to fill it and returns it. If it's unable to fill it, it still returns an empty Vector but not null. Do you have a stack trace for this exact problem?

AGP

I didn't say it returned null, I said it returned an empty Vector. But read my edit.

EgonOlsen

It returns an empty Vector if no node in the given subtree matches the pattern. However, if you want to look at it: http://www.jpct.net/download/hacks.

AGP

Thanks a lot, pal. Will report whatever I may find.

cyberkilla

Looks like a simple problem. I suspect it is because it hasn't found the xml element.

And, that might be because the model is not using triangles only - I am pretty sure I had to convert my models to triangles before exporting - this may be a part of the OgreXML format, or a limitation I imposed accidentally.

Hopefully, this is all that is wrong. Have you tried this already?
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG