From 502b292679eddb9b7ee286b2ba78442aa28dad05 Mon Sep 17 00:00:00 2001 From: Jonas Date: Thu, 31 Jan 2019 12:57:17 +0100 Subject: [PATCH] #12 should be the final fix (#14) --- README.md | 2 +- info.json | 2 +- src/pmon/pmon.lua | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9e3505b..a4dfce1 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ You can monitor multiple entities at the same time and give them names to distin ## Changelog -### 16.1.1 +### 16.1.2 - fix crash when other selection tools are used - change ingredients to make it buildable without oil diff --git a/info.json b/info.json index b0ffaba..c650b19 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "PowerMon", - "version": "16.1.1", + "version": "16.1.2", "title": "Power Monitor", "author": "Jason Miles, Tessiema", "contact": "jonasjurczok+factorio@gmail.com", diff --git a/src/pmon/pmon.lua b/src/pmon/pmon.lua index 7a8a193..90603d2 100644 --- a/src/pmon/pmon.lua +++ b/src/pmon/pmon.lua @@ -228,7 +228,11 @@ function pmon.on_player_selected_area(event) local player = game.players[event.player_index] local cursor_stack = player.cursor_stack - if (cursor_stack.valid and cursor_stack.name == "pmon-power-monitor") then + if ((not cursor_stack.valid) or (not cursor_stack.valid_for_read)) then + return + end + + if (cursor_stack.name == "pmon-power-monitor") then local entity = event.entities[1] if (entity) then