mirror of
https://github.com/charmbracelet/lipgloss.git
synced 2024-07-15 01:30:40 +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
|
||||
if maxHeight > 0 {
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user