# HG changeset patch
# User Edouard Tisserant
# Date 1543322054 -3600
# Node ID ed6b0e905fcb9e7b1421ecd1292043875c567e40
# Parent  9624575a9cac1d99e457103ff6956eade5bb6b06
Fix failing PLC build when building freshly created project that use default libraries blocks. When controller loads libraries according to attibutes in project files (BeremizRoot/Enable_{libname}_Library), use known default if attribute is missing.

diff -r 9624575a9cac -r ed6b0e905fcb ProjectController.py
--- a/ProjectController.py	Tue Nov 27 10:54:13 2018 +0100
+++ b/ProjectController.py	Tue Nov 27 13:34:14 2018 +0100
@@ -279,10 +279,14 @@
     def LoadLibraries(self):
         self.Libraries = []
         TypeStack = []
-        for libname, clsname, _default in features.libraries:
-            if self.BeremizRoot.Libraries is not None and \
-               getattr(self.BeremizRoot.Libraries,
-                       "Enable_" + libname + "_Library"):
+        for libname, clsname, lib_enabled in features.libraries:
+            if self.BeremizRoot.Libraries is not None:
+                enable_attr = getattr(self.BeremizRoot.Libraries,
+                                      "Enable_" + libname + "_Library")
+                if enable_attr is not None:
+                    lib_enabled = enable_attr
+
+            if lib_enabled:
                 Lib = GetClassImporter(clsname)()(self, libname, TypeStack)
                 TypeStack.append(Lib.GetTypes())
                 self.Libraries.append(Lib)