From b7bdb97f7df06478ea3a16da93dde8df9aba0b38 Mon Sep 17 00:00:00 2001 From: pancake Date: Thu, 23 Jul 2020 18:54:29 +0200 Subject: [PATCH] term: fix crash in `header` when divider.len < 2 (#5956) --- vlib/term/term.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vlib/term/term.v b/vlib/term/term.v index bf720e7747..1cc7fcb45e 100644 --- a/vlib/term/term.v +++ b/vlib/term/term.v @@ -49,7 +49,7 @@ pub fn h_divider(divider string) string { // e.g: term.header('TEXT', '=') // =============== TEXT =============== pub fn header(text, divider string) string { - if text.len == 0 { + if text.len == 0 || divider.len < 2 { return h_divider(divider) } cols,_ := get_terminal_size()