diff --git a/OsmAnd/src/net/osmand/plus/base/BasicProgressAsyncTask.java b/OsmAnd/src/net/osmand/plus/base/BasicProgressAsyncTask.java index ed406f4c40..1950da1fc9 100644 --- a/OsmAnd/src/net/osmand/plus/base/BasicProgressAsyncTask.java +++ b/OsmAnd/src/net/osmand/plus/base/BasicProgressAsyncTask.java @@ -110,9 +110,9 @@ public abstract class BasicProgressAsyncTask exte public int getProgressPercentage() { if (work > 0) { - return (progress * 100) / work; + return normalizeProgress((progress * 100) / work); } - return progress; + return normalizeProgress(progress); } public void setInterrupted(boolean interrupted) { @@ -135,4 +135,14 @@ public abstract class BasicProgressAsyncTask exte @Override public void setGeneralProgress(String genProgress) { } + + private int normalizeProgress(int progress) { + if (progress < 0) { + return 0; + } else if (progress <= 100) { + return progress; + } else { + return 99; + } + } } \ No newline at end of file