Skip to content

Commit ee06e98

Browse files
authored
fix(examples): resolve nil pointer dereference (#1663)
1 parent ba7c9b8 commit ee06e98

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

examples/textarea/main.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,12 @@ func (m model) View() tea.View {
9292
if !m.textarea.VirtualCursor() {
9393
c = m.textarea.Cursor()
9494

95-
// Set the y offset of the cursor based on the position of the textarea
96-
// in the application.
97-
offset := lipgloss.Height(m.headerView())
98-
c.Y += offset
95+
if c != nil {
96+
// Set the y offset of the cursor based on the position of the textarea
97+
// in the application.
98+
offset := lipgloss.Height(m.headerView())
99+
c.Y += offset
100+
}
99101
}
100102

101103
f := strings.Join([]string{

0 commit comments

Comments
 (0)