diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-10-30 22:15:55 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-10-30 22:15:55 +0100 |
commit | a9a8e04eab106c1d21381f79f8965fe50b94e235 (patch) | |
tree | 4a1113804e104fe24a8a545ad10cedc539f584a5 /src/memline.c | |
parent | 833e5dab143034b7e43bc0be49b2eb3687ff9ab7 (diff) | |
download | vim-git-a9a8e04eab106c1d21381f79f8965fe50b94e235.tar.gz |
patch 8.1.0501: cppcheck warns for using array index before bounds checkv8.1.0501
Problem: Cppcheck warns for using array index before bounds check.
Solution: Swap the conditions. (Dominique Pelle)
Diffstat (limited to 'src/memline.c')
-rw-r--r-- | src/memline.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/memline.c b/src/memline.c index 9789349fa..1d65a44d8 100644 --- a/src/memline.c +++ b/src/memline.c @@ -5029,8 +5029,8 @@ ml_updatechunk( curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines; } } - else if (line >= curline + buf->b_ml.ml_chunksize[curix].mlcs_numlines - && curix < buf->b_ml.ml_usedchunks - 1) + else if (curix < buf->b_ml.ml_usedchunks - 1 + && line >= curline + buf->b_ml.ml_chunksize[curix].mlcs_numlines) { /* Adjust cached curix & curline */ curline += buf->b_ml.ml_chunksize[curix].mlcs_numlines; |