fix: guard against nil ContextEvaluator func in memprovider Resolve#522
fix: guard against nil ContextEvaluator func in memprovider Resolve#522somaz94 wants to merge 1 commit into
Conversation
Signed-off-by: somaz <genius5711@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughModified InMemoryFlag.Resolve in the memprovider package to check both the ContextEvaluator pointer and the underlying function value for nil before invoking it, preventing a nil-pointer dereference panic. Added a regression test verifying fallback to DefaultVariant when ContextEvaluator points to a nil function. ChangesContextEvaluator nil guard
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
memprovider.InMemoryFlag.ContextEvaluatoris typed*func(...).Resolveonly checked the pointer for nil, so a non-nil pointer to a nil func passed the
guard and panicked on the dereference-and-call. This adds the missing inner
nil-func check so such a flag falls back to the default variant, plus a
regression test.
Fixes #521
Validation:
make test(go test -tags testtools -race): all packages pass, memprovider at 86.9% coveragemake lint(golangci-lint v2.9.0): 0 issues