From 2f97f929a5dcb8b13aec528103ebe0db088aa696 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 1 Dec 2012 06:29:04 +0000 Subject: fix for bug in console indent, was not copying the null terminator. also add assert to catch this case more quickly. --- source/blender/editors/space_console/console_draw.c | 3 ++- source/blender/editors/space_console/console_ops.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/space_console') diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c index f19835b7f85..a215b476094 100644 --- a/source/blender/editors/space_console/console_draw.c +++ b/source/blender/editors/space_console/console_draw.c @@ -146,7 +146,8 @@ static int console_textview_line_get(struct TextViewContext *tvc, const char **l ConsoleLine *cl = (ConsoleLine *)tvc->iter; *line = cl->line; *len = cl->len; - + // printf("'%s' %d\n", *line, cl->len); + BLI_assert(cl->line[cl->len] == '\0' && (cl->len == 0 || cl->line[cl->len - 1] != '\0')); return 1; } diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index bb46135545c..36716aeab95 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -444,7 +444,7 @@ static int console_indent_exec(bContext *C, wmOperator *UNUSED(op)) console_line_verify_length(ci, ci->len + len); - memmove(ci->line + len, ci->line, ci->len); + memmove(ci->line + len, ci->line, ci->len + 1); memset(ci->line, ' ', len); ci->len += len; BLI_assert(ci->len >= 0); -- cgit v1.2.3