From c1f41720fc3ba7b69e091326f1ce2ac69588fb13 Mon Sep 17 00:00:00 2001
From: sfan5 <sfan5@live.de>
Date: Mon, 6 Apr 2020 20:38:17 +0200
Subject: [PATCH] Fix crash on TNT explosions if tnt is disabled

---
 mods/tnt/init.lua | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mods/tnt/init.lua b/mods/tnt/init.lua
index 6565f852..1e2fb801 100644
--- a/mods/tnt/init.lua
+++ b/mods/tnt/init.lua
@@ -292,10 +292,15 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, owne
 	local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
 	local data = vm1:get_data()
 	local count = 0
-	local c_tnt = minetest.get_content_id("tnt:tnt")
+	local c_tnt
 	local c_tnt_burning = minetest.get_content_id("tnt:tnt_burning")
 	local c_tnt_boom = minetest.get_content_id("tnt:boom")
 	local c_air = minetest.get_content_id("air")
+	if enable_tnt then
+		c_tnt = minetest.get_content_id("tnt:tnt")
+	else
+		c_tnt = c_tnt_burning -- tnt is not registered if disabled
+	end
 	-- make sure we still have explosion even when centre node isnt tnt related
 	if explode_center then
 		count = 1
-- 
GitLab