fix(langfuse): correct nil check variable typo in extractModelInput#785
Open
SKDG042 wants to merge 1 commit intocloudwego:mainfrom
Open
fix(langfuse): correct nil check variable typo in extractModelInput#785SKDG042 wants to merge 1 commit intocloudwego:mainfrom
SKDG042 wants to merge 1 commit intocloudwego:mainfrom
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.
What type of PR is this?
fix
Check the PR title.
(Optional) Translate the PR title into Chinese.
修正 extractModelInput 中 nil 检查的循环变量的使用错误,应当使用in而非ins
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
In
callbacks/langfuse/utils.go:38, the nil-check inside thefor _, in := range insloop was mistakenly comparingins == nil(the slice itself) instead ofin == nil(the current element). This makes the guard useless: wheninsis nil, the loop body never executes; wheninsis non-nil but contains nil elements, the guard always evaluates to false, and the subsequentin.Messages/in.Extra/in.Configaccesses will panic on nil pointer dereference.Before
After
zh(optional):
callbacks/langfuse/utils.go:38中 for _, in := range ins 循环里的 nil 检查误将 in == nil(当前元素)写成了应该检查的 ins == nil(切片本身)。ins 为 nil 时循环根本不会进入;ins 非 nil 但含 nil 元素时,该判断恒为 false,后续 in.Messages 等访问会因空指针解引用 panic。(Optional) Which issue(s) this PR fixes:
(optional) The PR that updates user documentation: