DroidFish: Fixed crash due to division by zero.

Fixed crash that could happen when reading a PGN file at the same time
as another process was writing to the file.
This commit is contained in:
Peter Osterlund
2017-06-11 21:14:15 +02:00
parent ce28058ffd
commit 9aa9279366

View File

@@ -337,7 +337,7 @@ public class PGNFile {
gi = null; gi = null;
break; break;
} }
final int newPercent = (int)(filePos * 100 / fileLen); final int newPercent = fileLen == 0 ? 0 : (int)(filePos * 100 / fileLen);
if (newPercent > percent) { if (newPercent > percent) {
percent = newPercent; percent = newPercent;
if (progress != null) { if (progress != null) {