1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-02-17 07:30:16 -05:00

Avoid division by zero.

Fixes issue 2259
This commit is contained in:
cketti 2010-09-03 00:56:19 +00:00
parent 8fa1c793ea
commit 0c27a1ab0e

View File

@ -308,12 +308,16 @@ public class MessageList
if (mCurrentFolder != null && mCurrentFolder.loading && mAdapter.mListener.getFolderTotal() > 0) if (mCurrentFolder != null && mCurrentFolder.loading && mAdapter.mListener.getFolderTotal() > 0)
{ {
level = (Window.PROGRESS_END / mAdapter.mListener.getFolderTotal()) * (mAdapter.mListener.getFolderCompleted()) ; int divisor = mAdapter.mListener.getFolderTotal();
if (divisor != 0)
{
level = (Window.PROGRESS_END / divisor) * (mAdapter.mListener.getFolderCompleted()) ;
if (level > Window.PROGRESS_END) if (level > Window.PROGRESS_END)
{ {
level = Window.PROGRESS_END; level = Window.PROGRESS_END;
} }
} }
}
getWindow().setFeatureInt(Window.FEATURE_PROGRESS, level); getWindow().setFeatureInt(Window.FEATURE_PROGRESS, level);
} }