aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--url-mode.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/url-mode.c b/url-mode.c
index 00d38d75..f04550f8 100644
--- a/url-mode.c
+++ b/url-mode.c
@@ -389,8 +389,11 @@ regex_detected(const struct terminal *term, enum url_action action,
}
/* Terminate the last line, if necessary */
- if (vline->len > 0 && vline->utf8[vline->len - 1] != '\0')
+ if (vline_idx < ALEN(vlines) &&
+ vline->len > 0 && vline->utf8[vline->len - 1] != '\0')
+ {
vline->utf8[vline->len++] = '\0';
+ }
for (size_t i = 0; i < ALEN(vlines); i++) {
const struct vline *v = &vlines[i];