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:
parent
56db9ee6e9
commit
59701725d0
1 changed files with 3 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue