From 4dd363e6b7fc3cc1fda3544f93ea78df4ba5f2a5 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 10 Jan 2020 19:19:15 +0100 Subject: [PATCH] Prevent crash --- app/src/main/java/eu/faircode/email/SwipeListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/SwipeListener.java b/app/src/main/java/eu/faircode/email/SwipeListener.java index 851d00d937..984cc9612f 100644 --- a/app/src/main/java/eu/faircode/email/SwipeListener.java +++ b/app/src/main/java/eu/faircode/email/SwipeListener.java @@ -46,7 +46,7 @@ public class SwipeListener implements View.OnTouchListener { int dx = Math.round(me2.getX() - me1.getX()); int dy = Math.round(me2.getY() - me1.getY()); long dt = me2.getEventTime() - me1.getEventTime(); - long vx = dx * 1000 / dt; + long vx = (dt == 0 ? 0 : dx * 1000 / dt); if (Math.abs(dx) > Math.abs(dy)) { Log.i("Swipe dx=" + dx + "/" + MOVE_THRESHOLD + " dt=" + dt + " vx=" + vx + "/" + SPEED_THRESHOLD);