From ecd0eeea1ef9b10c7b365efd273f87ee947c0a15 Mon Sep 17 00:00:00 2001 From: Alexander Weber Date: Wed, 18 Jan 2017 23:43:16 +0100 Subject: [PATCH] npcf_builder add exception handling if file could not be read --- npcf_builder/init.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/npcf_builder/init.lua b/npcf_builder/init.lua index e9ee451..1a30fbd 100644 --- a/npcf_builder/init.lua +++ b/npcf_builder/init.lua @@ -56,6 +56,11 @@ local function load_schematic(self, filename) if SCHEMLIB_PATH then self.schemlib_plan = schemlib.plan.new() self.schemlib_plan:read_from_schem_file(fullpath) + if not self.schemlib_plan.data then + print("file could not be read") + reset_build(self) + return + end self.schemlib_plan.anchor_pos = self.metadata.build_pos self.schemlib_plan:apply_flood_with_air(3, 0, 3) schemlib.mapping.do_mapping(self.schemlib_plan.data)