Fix(router): handle debug.getinfo returning nil for non-Lua functions#4
Open
PlumBlossomMaid wants to merge 1 commit intoTRIGONIM:mainfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
debug.getinfo(fn, "Su")behaves differently depending on the function type:nparamsfieldnilor a table withoutnparamsThis inconsistency causes
attempt to compare number with nilerrors inlayer.lua:57andlayer.lua:47on Windows/Lua 5.1 environments.Root Cause
The
pegasusHTTP server passes some C-level callbacks and wrapped functions through the middleware chain. When these reach the layer handlers,debug.getinfofails to extract parameter count information.Fix
Added defensive checks before accessing
nparams:Before:
After:
Affected Functions
LAYER_MT:handle_requestLAYER_MT:handle_errorEnvironment