From b4c542cc6ca4d40adec121676b62d94e115de9a7 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Sat, 8 Jan 2022 11:16:30 +0300 Subject: [PATCH] Fix. Set/Del breakpoints may not work in some cases. Problem that if buf has partial line e.g. `SETB fi` the mobdebug will not recognize it as a set breakpoint command. --- src/mobdebug.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mobdebug.lua b/src/mobdebug.lua index 2a8257f..386a24a 100644 --- a/src/mobdebug.lua +++ b/src/mobdebug.lua @@ -511,8 +511,8 @@ local function handle_breakpoint(peer) if buf:sub(2,2) ~= 'E' then return end -- need to read few more characters - buf = buf .. readnext(peer, 5-#buf) - if buf ~= 'SETB ' and buf ~= 'DELB ' then return end + if #buf < 5 then buf = buf .. readnext(peer, 5-#buf) end + if buf:sub(1,5) ~= 'SETB ' and buf:sub(1,5) ~= 'DELB ' then return end local res, _, partial = peer:receive("*l") -- get the rest of the line; blocking if not res then