From 0ef5c3eee72af084334f0c550cde564d36d8584b Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 19 Sep 2024 14:03:07 +0200 Subject: [PATCH] Chess: Fix crash if call get_figurine_id("") --- src/chess.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/chess.lua b/src/chess.lua index a7db0e2..aa4b7ad 100644 --- a/src/chess.lua +++ b/src/chess.lua @@ -1089,7 +1089,11 @@ end local function get_figurine_id(piece_itemname) local piece_s = piece_itemname:match(":(%w+_%w+)") - return figurines_str:match("(%d+)=chess_figurine_" .. piece_s) + if not piece_s then + return MOVES_LIST_SYMBOL_EMPTY + else + return figurines_str:match("(%d+)=chess_figurine_" .. piece_s) + end end