fix(discussion view): guard against empty comment slice in replies mode

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Babak K. Shandiz 2026-04-27 18:46:14 +01:00
parent 56db9ee6e9
commit 59701725d0
No known key found for this signature in database
GPG key ID: 9472CAEFF56C742E

View file

@ -245,6 +245,9 @@ func viewRun(opts *ViewOptions) error {
}
defer opts.IO.StopPager()
if len(discussion.Comments.Comments) == 0 {
return fmt.Errorf("no comment found for reply ID %s", opts.Replies)
}
comment := discussion.Comments.Comments[0]
if opts.IO.IsStdoutTTY() {
return printHumanReplies(opts, &comment)