check to see if s.builder is nil

This commit is contained in:
Michael Kutowski
2023-11-23 00:04:06 +01:00
committed by GitHub
parent f635d3d8af
commit 3d90e580c5

View File

@@ -124,7 +124,7 @@ setup_once :: proc(s: ^State, builder: ^strings.Builder) {
// returns true when the builder had content to be cleared
// clear builder&selection and the undo|redo stacks
clear_all :: proc(s: ^State) -> (cleared: bool) {
if len(s.builder.buf) > 0 {
if s.builder != nil && len(s.builder.buf) > 0 {
clear(&s.builder.buf)
s.selection = {}
cleared = true