diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-12-01 10:29:04 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-12-01 10:29:04 +0400 |
commit | 2f97f929a5dcb8b13aec528103ebe0db088aa696 (patch) | |
tree | 07d8c37306b788fba6b10fdefd6e391c2a4ad95a /source/blender/editors/space_console | |
parent | eb490f3aaebb92f3eae232cec3bbc5776d52104b (diff) |
fix for bug in console indent, was not copying the null terminator.
also add assert to catch this case more quickly.
Diffstat (limited to 'source/blender/editors/space_console')
-rw-r--r-- | source/blender/editors/space_console/console_draw.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_console/console_ops.c | 2 |
2 files changed, 3 insertions, 2 deletions
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); |