diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-10-30 16:08:44 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-10-30 16:08:44 +0400 |
commit | 8a658d40508fd192fe463e0b82c2a813a6d22d31 (patch) | |
tree | 8b2f7cadb7a65095706ed1fb2db974fe9b1428e7 /source | |
parent | ef6050400980cc780550f2703b411536f4f4ee2e (diff) |
add in assert's to double check the line lenth is never <0
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_console/console_ops.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 6f7e6b1926f..d3ae5373a18 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -450,6 +450,7 @@ static int console_indent_exec(bContext *C, wmOperator *UNUSED(op)) memmove(ci->line + len, ci->line, ci->len); memset(ci->line, ' ', len); ci->len += len; + BLI_assert(ci->len >= 0); console_line_cursor_set(ci, ci->cursor + len); console_select_offset(sc, len); @@ -497,6 +498,8 @@ static int console_unindent_exec(bContext *C, wmOperator *UNUSED(op)) memmove(ci->line, ci->line + len, (ci->len - len) + 1); ci->len -= len; + BLI_assert(ci->len >= 0); + console_line_cursor_set(ci, ci->cursor - len); console_select_offset(sc, -len); @@ -555,6 +558,7 @@ static int console_delete_exec(bContext *C, wmOperator *op) if (stride) { memmove(ci->line + ci->cursor, ci->line + ci->cursor + stride, (ci->len - ci->cursor) + 1); ci->len -= stride; + BLI_assert(ci->len >= 0); done = TRUE; } } @@ -571,6 +575,7 @@ static int console_delete_exec(bContext *C, wmOperator *op) ci->cursor -= stride; /* same as above */ memmove(ci->line + ci->cursor, ci->line + ci->cursor + stride, (ci->len - ci->cursor) + 1); ci->len -= stride; + BLI_assert(ci->len >= 0); done = TRUE; } } |