[Fix] Check for null node in xml.
[Fix] Corrected help
This commit is contained in:
parent
bdc0157ea6
commit
5609dd7b22
@ -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");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user