fix(telegram): guard token.trim() against undefined to prevent startup crash#31973
Merged
steipete merged 2 commits intoopenclaw:mainfrom Mar 2, 2026
Merged
Conversation
Contributor
Greptile SummaryFixed a startup crash in the Telegram extension when
Confidence Score: 5/5
Last reviewed commit: d5ea338 |
d5ea338 to
3610ace
Compare
steipete
added a commit
to ningding97/openclaw
that referenced
this pull request
Mar 2, 2026
…p crash When account.token is undefined (e.g. missing botToken config), calling .trim() directly throws "Cannot read properties of undefined". Use nullish coalescing to fall back to empty string before trimming. Closes openclaw#31944
3610ace to
68b3453
Compare
Contributor
|
Landed via temp rebase onto main. Thanks @ningding97! |
execute008
pushed a commit
to execute008/openclaw
that referenced
this pull request
Mar 2, 2026
dawi369
pushed a commit
to dawi369/davis
that referenced
this pull request
Mar 3, 2026
OWALabuy
pushed a commit
to kcinzgg/openclaw
that referenced
this pull request
Mar 4, 2026
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
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.
Closes #31944
Problem
findTelegramTokenOwnerAccountIdand the health-check path callaccount.token.trim()without null guard. Whenaccount.tokenisundefined(missing botToken config / tokenFile not found), the channel crashes on startup with:Fix
Use
(account.token ?? "").trim()in both call sites.Tests
pnpm test -- extensions/telegram/src/channel.test.ts(5 tests pass)