fix: add null safety to local.agent.current() - Issue #10346#10376
fix: add null safety to local.agent.current() - Issue #10346#10376Luckybalabala wants to merge 1 commit intoanomalyco:devfrom
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Based on the search results, I found several related PRs addressing similar null safety issues with Related PRs:
Note: These PRs suggest this is a recurring issue. You may want to check if #8882, #8745, or #9877 already address issue #10346, or if those fixes were incomplete/reverted. There might be a need for a more comprehensive solution to prevent this pattern from reoccurring. |
1d93fde to
5a350e3
Compare
5a350e3 to
a1928cc
Compare
Problem
When
local.agent.current()returnsundefined, the code attempts to access properties on it, causing runtime errors.Solution
Added optional chaining (
?.) and nullish coalescing (??) operator to handle the case when no agent is active:Testing
Fixes #10346