fix: guard against non-numeric speaker label crashing TranscriptSegment#5386
Open
krushnarout wants to merge 1 commit intomainfrom
Open
fix: guard against non-numeric speaker label crashing TranscriptSegment#5386krushnarout wants to merge 1 commit intomainfrom
krushnarout wants to merge 1 commit intomainfrom
Conversation
int.parse throws FormatException when speaker arrives as "SPEAKER_None" from the backend. Replaced with int.tryParse ?? 0 and added split guard. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Greptile SummaryThis PR fixes a
Confidence Score: 5/5
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["TranscriptSegment constructor<br/>called with speaker value"] --> B{"speaker == null?"}
B -- "Yes" --> E["parts = []"]
B -- "No" --> C["parts = speaker.split('_')"]
C --> D{"parts.length > 1?"}
D -- "No<br/>e.g. 'SPEAKER' or empty" --> F["speakerId = 0"]
D -- "Yes<br/>e.g. 'SPEAKER_00' or 'SPEAKER_None'" --> G["int.tryParse(parts[1])"]
G --> H{"Parse succeeded?"}
H -- "Yes<br/>e.g. parts[1] = '00'" --> I["speakerId = parsed int"]
H -- "No<br/>e.g. parts[1] = 'None'" --> J["speakerId = 0 (fallback)"]
E --> F
Last reviewed commit: 0af437f |
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.
Summary
omi/app/lib/backend/schema/transcript_segment.dart
Line 58 in 96da1b0
speakerfrom the API can arrive as"SPEAKER_None"(Python'sNoneserialized into a string).int.parse("None")throws aFormatException, crashing the app on conversation load.int.parsewithint.tryParse(...) ?? 0and guarded the split index — same pattern already used forstart/endin the same file.🤖 Generated with Claude Code