mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
vim-patch:9.1.0458: Coverity complains about division by zero (#29149)
Problem: Coverity complains about division by zero
Solution: Check explicitly for sw_val being zero
Shouldn't happen, since tabstop value should always be larger than zero.
So just add this as a safety measure.
7737ce519b
Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -282,8 +282,10 @@ void op_shift(oparg_T *oap, bool curs_top, int amount)
|
|||||||
/// @param call_changed_bytes call changed_bytes()
|
/// @param call_changed_bytes call changed_bytes()
|
||||||
void shift_line(bool left, bool round, int amount, int call_changed_bytes)
|
void shift_line(bool left, bool round, int amount, int call_changed_bytes)
|
||||||
{
|
{
|
||||||
const int sw_val = get_sw_value_indent(curbuf, left);
|
int sw_val = get_sw_value_indent(curbuf, left);
|
||||||
|
if (sw_val == 0) {
|
||||||
|
sw_val = 1; // shouldn't happen, just in case
|
||||||
|
}
|
||||||
int count = get_indent(); // get current indent
|
int count = get_indent(); // get current indent
|
||||||
|
|
||||||
if (round) { // round off indent
|
if (round) { // round off indent
|
||||||
|
Reference in New Issue
Block a user