tyls: Make sure we never divide by zero
Avoid the case where cols is 0 and we divide through it. CID 1100655
This commit is contained in:
parent
2e95700161
commit
8ae31617a1
|
@ -640,6 +640,7 @@ list_dir(const char *dir, int mode)
|
||||||
stuff--;
|
stuff--;
|
||||||
}
|
}
|
||||||
if (cols > num) cols = num;
|
if (cols > num) cols = num;
|
||||||
|
if (cols == 0) cols = 1;
|
||||||
rows = ((num + (cols - 1)) / cols);
|
rows = ((num + (cols - 1)) / cols);
|
||||||
for (i = 0; i < rows; i++)
|
for (i = 0; i < rows; i++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue