Skip to content

fix: add null check for inputValue in ChatTextArea#11905

Open
Br1an67 wants to merge 1 commit intoRooCodeInc:mainfrom
Br1an67:fix/issue-11753-inputvalue-trim-crash
Open

fix: add null check for inputValue in ChatTextArea#11905
Br1an67 wants to merge 1 commit intoRooCodeInc:mainfrom
Br1an67:fix/issue-11753-inputvalue-trim-crash

Conversation

@Br1an67
Copy link

@Br1an67 Br1an67 commented Mar 10, 2026

Fixes #11753

Summary

Added defensive null checks for inputValue in ChatTextArea.tsx to prevent "Cannot read properties of undefined (reading 'trim')" error. The fix ensures the component handles undefined inputValue gracefully by using fallback values.

Changes

  • Modified hasInputContent useMemo to use (inputValue || "").trim() instead of inputValue.trim()
  • Modified handleEnhancePrompt to use (inputValue || "").trim() instead of inputValue.trim()

Testing

  • Existing tests continue to pass with no modifications needed
  • The change is backward compatible since empty strings and non-empty strings work correctly

Interactively review PR in Roo Code Cloud

The inputValue prop could be undefined when the component renders,
causing a crash when calling .trim() on it. Added defensive
null checks using fallback to empty string.
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Mar 10, 2026
@Br1an67 Br1an67 mentioned this pull request Mar 10, 2026
@dosubot dosubot bot added the bug Something isn't working label Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]

1 participant