diff --git a/changelog.txt b/changelog.txt index 9da35be..c372364 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,9 @@ +--------------------------------------------------------------------------------------------------- +Version: 0.5.1 +Date: 05. 09. 2020 + Bugfixes: + - Fix crash on selecting new blueprint book + --------------------------------------------------------------------------------------------------- Version: 0.5.0 Date: 31. 01. 2020 diff --git a/info.json b/info.json index 8c01dce..567dd65 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "BlueprintExtensions", - "version": "0.5.0", + "version": "0.5.1", "title": "Blueprint Extensions", "author": "Dewin", "contact": "https://github.com/dewiniaid/BlueprintExtensions", diff --git a/util.lua b/util.lua index fadba7f..e33734c 100644 --- a/util.lua +++ b/util.lua @@ -8,7 +8,11 @@ function Util.get_blueprint(bp) return nil end if bp.is_blueprint_book and bp.active_index then - return Util.get_blueprint(bp.get_inventory(defines.inventory.item_main)[bp.active_index]) + local inventory = bp.get_inventory(defines.inventory.item_main) + if inventory.get_item_count() == 0 then + return nil + end + return Util.get_blueprint(inventory[bp.active_index]) end if bp.is_blueprint then return bp