summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlastair Poole <netstar@gmail.com>2020-01-05 17:36:33 +0000
committerAlastair Poole <netstar@gmail.com>2020-01-05 17:36:33 +0000
commit207da69c97d86ccd6f1e354b60b579a3d81f375c (patch)
tree72a5d5f355baf641e82548aa0d718cce40f31333
parentf2b88560a091d1f8c8a72b0237273475b4da5328 (diff)
downloadefl-207da69c97d86ccd6f1e354b60b579a3d81f375c.tar.gz
elm_code_text: Return empty string on 0 length.
Throughout elm_code we rely on this function returning a valid string (unless the line object isn't set/is NULL).
-rw-r--r--src/lib/elementary/elm_code_text.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/elementary/elm_code_text.c b/src/lib/elementary/elm_code_text.c
index d27081a251..56fc1a07c5 100644
--- a/src/lib/elementary/elm_code_text.c
+++ b/src/lib/elementary/elm_code_text.c
@@ -19,6 +19,9 @@ elm_code_line_text_get(Elm_Code_Line *line, unsigned int *length)
if (length)
*length = line->length;
+ if (!line->length)
+ return "";
+
if (line->modified)
return line->modified;
return line->content;