Skip to content

Fix crash when scope is absent from access token#145

Merged
onevcat merged 2 commits intomasterfrom
fix/access-token-scopes-null-crash
Apr 6, 2026
Merged

Fix crash when scope is absent from access token#145
onevcat merged 2 commits intomasterfrom
fix/access-token-scopes-null-crash

Conversation

@onevcat
Copy link
Copy Markdown
Member

@onevcat onevcat commented Apr 6, 2026

Summary

  • Fix runtime crash in AccessToken.scopes when scope key is absent from the native SDK response
  • Use null-safe chain with empty list fallback: (_data['scope'] as String?)?.split(' ') ?? <String>[]
  • No public API change — return type stays List<String>

Closes the underlying issue reported in #144 without introducing breaking API changes.

Test plan

  • flutter analyze passes
  • flutter test passes — all existing tests green

🤖 Generated with Claude Code

The `scopes` getter called `.split()` directly on `_data['scope']`
which crashes at runtime if the key is absent. Use null-safe chain
with an empty list fallback to keep the public API unchanged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Android LINE SDK does not expose token_type in its LineAccessToken
class, so getCurrentAccessToken and refreshToken responses lack this
field. Default to 'Bearer' when absent, matching the current LINE
Platform behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@onevcat onevcat merged commit 7730171 into master Apr 6, 2026
2 checks passed
@onevcat onevcat deleted the fix/access-token-scopes-null-crash branch April 6, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant