termstatus: fix crash when printing empty string

This commit is contained in:
Michael Eischer
2025-09-14 13:52:00 +02:00
parent e9b6149303
commit 91ecac8003

View File

@@ -237,7 +237,7 @@ func (t *Terminal) runWithoutStatus(ctx context.Context) {
func (t *Terminal) print(line string, isErr bool) {
// make sure the line ends with a line break
if line[len(line)-1] != '\n' {
if len(line) == 0 || line[len(line)-1] != '\n' {
line += "\n"
}