Page 1 of 1

TinyXMLParser failure to parse reports no error

Posted: Sat Nov 22, 2008 21:12
by Arinae
Hi. I'm just learning how to use your very comprehensive GUI system. While writing my layout, I accidentally added a comma to separate XML attributes (too much Lua coding, I think). I spent a long afternoon wondering why only some of my layout was being drawn before noticing it.

I checked the code, and it looks like in the TinyXMLDocument constructor CEGUITinyXML::TiXmlDocument::parse() is called without checking the return value. Checking for NULL and throwing makes sure errant commas won't bother me again.

I suspect that fixing this could save a lot of headaches for other CEGUI newbies.

(I am only using 0.5, but I checked trunk in the SVN browser and it would appear to have the same problem)

Posted: Sun Nov 23, 2008 16:30
by CrazyEddie
Hi, and welcome :)

Thanks for reporting the issue. I'll make sure it doesn't bother anybody else either ;)

CE.

Posted: Thu Nov 27, 2008 08:25
by earthsruler
Just some food for thought here:

This is the comment for the parse function that is now being checked:

Code: Select all


   /*   Attribute parsing starts: first letter of the name
                   returns: the next char after the value end quote
   */


Therefore (as i found when i updated) not having a blank line at the end of a valid layout will make it throw an error which i believe is far more likely to burn noobies :).

Based on that comment I'm not sure that checking the return value for validity is correct usage. I have been wrong before though :wink:

ER.

Posted: Thu Nov 27, 2008 09:44
by CrazyEddie
Hmmmm :?

I may look into this and see what I can do (perhaps checking the end of the loaded data and adding a newline if it's missing).

Thanks for the heads-up on the potential new issue :)

CE.

[Edit]
I added a fix for this. It's basically a kludge, but it works :-p

Posted: Fri Nov 28, 2008 00:00
by earthsruler
Sweet thanks.

I had already added a new line to the end of all our files manually though :(, but this will fix and new messed up files.

ER.