From 1539891aa8f925b24c746892f026dc05ea1b3b97 Mon Sep 17 00:00:00 2001
From: Stuart Buchanan <stuart_d_buchanan@yahoo.co.uk>
Date: Sat, 9 Feb 2013 20:27:05 +0000
Subject: [PATCH] Bugfix for aircraft without checklists.

---
 Nasal/checklist.nas | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Nasal/checklist.nas b/Nasal/checklist.nas
index 6261debed..52ae324b5 100644
--- a/Nasal/checklist.nas
+++ b/Nasal/checklist.nas
@@ -3,10 +3,13 @@
 # Convert checklists into full tutorials.
 var convert_checklists = func {
 
-  var checklists = props.globals.getNode("/sim/checklists").getChildren("checklist");
-  var tutorials = props.globals.getNode("/sim/tutorials");
+  if ((props.globals.getNode("/sim/checklists") != nil)                            and 
+      (props.globals.getNode("/sim/checklists").getChildren("checklist") != nil)   and
+      (size(props.globals.getNode("/sim/checklists").getChildren("checklist")) > 0)    )
+  {
+    var checklists = props.globals.getNode("/sim/checklists").getChildren("checklist");
+    var tutorials = props.globals.getNode("/sim/tutorials", 1);
 
-  if (size(checklists)) {
     foreach (var ch; checklists) {
       var name = ch.getNode("title", 1).getValue();
       var tutorial = tutorials.getNode("tutorial[" ~ size(tutorials.getChildren("tutorial")) ~ "]", 1);