mirror of
https://github.com/charmbracelet/lipgloss.git
synced 2024-09-11 14:07:21 +03:00
fix(style): possible nil panic (#245)
This commit is contained in:
parent
96795629c1
commit
d760238dd2
5
style.go
5
style.go
@ -402,7 +402,10 @@ func (s Style) Render(strs ...string) string {
|
|||||||
// Truncate according to MaxHeight
|
// Truncate according to MaxHeight
|
||||||
if maxHeight > 0 {
|
if maxHeight > 0 {
|
||||||
lines := strings.Split(str, "\n")
|
lines := strings.Split(str, "\n")
|
||||||
str = strings.Join(lines[:min(maxHeight, len(lines))], "\n")
|
height := min(maxHeight, len(lines))
|
||||||
|
if len(lines) > 0 {
|
||||||
|
str = strings.Join(lines[:height], "\n")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if transform != nil {
|
if transform != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user