aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/formatter/formatter.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/formatter/formatter.c b/src/formatter/formatter.c
index 2c52aa63..07a70afa 100644
--- a/src/formatter/formatter.c
+++ b/src/formatter/formatter.c
@@ -54,7 +54,9 @@ PUREFUNC text_opts_t choose_text_options(ast_list_t *chunks) {
}
static bool starts_with_id(Text_t text) {
+ if (text.length <= 0) return false;
List_t codepoints = Text$utf32(Text$slice(text, I_small(1), I_small(1)));
+ if (codepoints.length <= 0 || codepoints.data == NULL) return false;
return uc_is_property_xid_continue(*(ucs4_t *)codepoints.data);
}