From 3879d90b50160cd93fec2aef58fa0ef44084a4c8 Mon Sep 17 00:00:00 2001 From: Jipok Date: Sun, 12 Dec 2021 02:49:15 +0500 Subject: [PATCH] Validate input Unicode codepoint --- data/core/commands/doc.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/data/core/commands/doc.lua b/data/core/commands/doc.lua index 885b1696..d9ddc85e 100644 --- a/data/core/commands/doc.lua +++ b/data/core/commands/doc.lua @@ -123,7 +123,12 @@ local commands = { ["doc:type-unicode"] = function() core.command_view:enter("Unicode code point", function(text) -- It is possible both HEX and DEC, tonumber will converts - doc():text_input(common.codepoint_to_utf8(tonumber(text))) + local number = tonumber(text) + if number ~= nil then + doc():text_input(common.codepoint_to_utf8(number)) + else + core.error("Wrong Unicode codepoint") + end end) core.command_view:set_text("0x") end,