DroidFish: Secure FEN reader against division by zero.

This commit is contained in:
Peter Osterlund 2017-06-11 21:20:19 +02:00
parent 9aa9279366
commit 97662f067e

View File

@ -82,7 +82,7 @@ public class FENFile {
continue;
FenInfo fi = new FenInfo(fenNo++, line.trim());
fensInFile.add(fi);
final int newPercent = (int)(filePos * 100 / fileLen);
final int newPercent = fileLen == 0 ? 0 : (int)(filePos * 100 / fileLen);
if (newPercent > percent) {
percent = newPercent;
if (progress != null) {