1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

term: fix crash in header when divider.len < 2 (#5956)

This commit is contained in:
pancake 2020-07-23 18:54:29 +02:00 committed by GitHub
parent b537d8e23e
commit b7bdb97f7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()