Skip to content

fix(format): prevent panic when thread has no replies in time range#600

Merged
rusq merged 1 commit intorusq:masterfrom
ChrisEdwards:fix/issue-599-thread-slice-panic
Jan 28, 2026
Merged

fix(format): prevent panic when thread has no replies in time range#600
rusq merged 1 commit intorusq:masterfrom
ChrisEdwards:fix/issue-599-thread-slice-panic

Conversation

@ChrisEdwards
Copy link
Copy Markdown
Contributor

Summary

Fixes #599

When using slackdump convert with a time range filter, threads that have no replies within the specified time range cause a panic due to an out-of-bounds slice operation.

The getThread function returns mm[1:] to skip the parent message, but when there are no replies (only the parent or empty), this causes a panic.

Changes

  • Add bounds check before slicing to skip the parent message
  • Return empty slice when there are no replies to process

Test plan

  • Run slackdump convert with a time range that excludes thread replies
  • Verify no panic occurs and empty threads are handled gracefully

Add bounds check before slicing thread messages to handle edge case
where thread parent exists but all replies are outside the archived
time range.

Fixes rusq#599
@rusq
Copy link
Copy Markdown
Owner

rusq commented Jan 28, 2026

Thanks @ChrisEdwards !

@rusq rusq merged commit 64df624 into rusq:master Jan 28, 2026
3 checks passed
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.

panic in format text: slice bounds out of range when thread has no replies in time range

2 participants