From 5609dd7b224e3e4a9f4f4c3124b59b5c76811e64 Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Sun, 3 Feb 2013 22:13:13 +0000
Subject: [PATCH] [Fix] Check for null node in xml. [Fix] Corrected help

---
 src/main.c | 2 +-
 src/ship.c | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/main.c b/src/main.c
index 562ba14..7f80a19 100644
--- a/src/main.c
+++ b/src/main.c
@@ -45,7 +45,7 @@ static void print_usage(char** argv) {
   //LOG("\t-h n - Set height to (n)");
   LOG("\t-j n,  --joystick n  - Use joystick (n)");
   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");
 }
 
diff --git a/src/ship.c b/src/ship.c
index 1bb46b6..77a58f6 100644
--- a/src/ship.c
+++ b/src/ship.c
@@ -18,7 +18,7 @@
 #define SHIP_GFX  "../gfx/ship/"
 
 static Ship* ship_stack = NULL;
-static int ships;
+static int ships = 0;
 
 // Get a ship based on it's name.
 Ship* get_ship(const char* name) {
@@ -124,7 +124,8 @@ int ships_load(void) {
     if(xmlTextReaderNodeType(reader)==XML_NODE_START &&
           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) {
         ship_stack = tmp = ship_parse(node);
         ships = 1;