summaryrefslogtreecommitdiff
path: root/src/dged/text.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dged/text.c')
-rw-r--r--src/dged/text.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/dged/text.c b/src/dged/text.c
index bc2b1fc..30036a0 100644
--- a/src/dged/text.c
+++ b/src/dged/text.c
@@ -184,10 +184,18 @@ void insert_at(struct text *text, uint32_t line, uint32_t col, uint8_t *data,
}
uint32_t text_line_length(struct text *text, uint32_t lineidx) {
+ if (lineidx >= text_num_lines(text)) {
+ return 0;
+ }
+
return text->lines[lineidx].nchars;
}
uint32_t text_line_size(struct text *text, uint32_t lineidx) {
+ if (lineidx >= text_num_lines(text)) {
+ return 0;
+ }
+
return text->lines[lineidx].nbytes;
}