Skip to content

Commit

Permalink
Validate lower bound for available help pages (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ratizux authored May 23, 2024
1 parent 9772458 commit f9ebbab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion help.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ local function handleHelpPage(a_Player, a_PageNumber, a_Beginning)
local firstLine = (a_PageNumber - 1) * g_CommandsPerPage + 1
local lastLine = firstLine + g_CommandsPerPage
local maxPages = math.ceil(numCommands / g_CommandsPerPage)
if (firstLine > numCommands) then
if (firstLine > numCommands or firstLine < 0) then
a_Player:SendMessageFailure("The requested page is not available. Only pages 1 - " .. maxPages .. " are available.")
return true
end
Expand Down

0 comments on commit f9ebbab

Please sign in to comment.