[Fix] Check for null node in xml.

[Fix] Corrected help
This commit is contained in:
Allanis 2013-02-03 22:13:13 +00:00
parent bdc0157ea6
commit 5609dd7b22
2 changed files with 4 additions and 3 deletions

View File

@ -45,7 +45,7 @@ static void print_usage(char** argv) {
//LOG("\t-h n - Set height to (n)"); //LOG("\t-h n - Set height to (n)");
LOG("\t-j n, --joystick n - Use joystick (n)"); LOG("\t-j n, --joystick n - Use joystick (n)");
LOG("\t-J s, --joystick s - Use joystick whose name contains (s)"); LOG("\t-J s, --joystick s - Use joystick whose name contains (s)");
LOG("\t--help - Display this message and exit."); LOG("\t-h --help - Display this message and exit.");
LOG("\t-v - Print the version and exit"); LOG("\t-v - Print the version and exit");
} }

View File

@ -18,7 +18,7 @@
#define SHIP_GFX "../gfx/ship/" #define SHIP_GFX "../gfx/ship/"
static Ship* ship_stack = NULL; static Ship* ship_stack = NULL;
static int ships; static int ships = 0;
// Get a ship based on it's name. // Get a ship based on it's name.
Ship* get_ship(const char* name) { Ship* get_ship(const char* name) {
@ -124,7 +124,8 @@ int ships_load(void) {
if(xmlTextReaderNodeType(reader)==XML_NODE_START && if(xmlTextReaderNodeType(reader)==XML_NODE_START &&
strcmp((char*)xmlTextReaderConstName(reader), XML_SHIP)==0) { strcmp((char*)xmlTextReaderConstName(reader), XML_SHIP)==0) {
node = xmlTextReaderCurrentNode(reader); // Node to process. node = xmlTextReaderCurrentNode(reader); // Node to processr
if(node == NULL) break; // No node.
if(ship_stack == NULL) { if(ship_stack == NULL) {
ship_stack = tmp = ship_parse(node); ship_stack = tmp = ship_parse(node);
ships = 1; ships = 1;