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:
Stefan Schmidt 2014-01-30 13:19:19 +01:00 committed by Boris Faure
parent d1810ed034
commit f1deb3ca3e
1 changed files with 1 additions and 0 deletions

View File

@ -640,6 +640,7 @@ list_dir(const char *dir, int mode)
stuff--;
}
if (cols > num) cols = num;
if (cols == 0) cols = 1;
rows = ((num + (cols - 1)) / cols);
for (i = 0; i < rows; i++)
{