From 4dc2e2e3fdab32117fafd9133cd39d1e5e6d1ad7 Mon Sep 17 00:00:00 2001 From: Alexander Schepp Date: Wed, 31 Oct 2012 21:06:30 +0100 Subject: [PATCH] Handle int overflow in SetExpFix --- .../com/earth2me/essentials/craftbukkit/SetExpFix.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/SetExpFix.java b/Essentials/src/com/earth2me/essentials/craftbukkit/SetExpFix.java index 7ed3034c3..e484ebfe1 100644 --- a/Essentials/src/com/earth2me/essentials/craftbukkit/SetExpFix.java +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/SetExpFix.java @@ -67,6 +67,10 @@ public class SetExpFix exp += getExpAtLevel(currentLevel); currentLevel++; } + if (exp < 0) + { + exp = Integer.MAX_VALUE; + } return exp; } @@ -82,6 +86,10 @@ public class SetExpFix currentLevel--; exp += getExpAtLevel(currentLevel); } + if (exp < 0) + { + exp = Integer.MAX_VALUE; + } return exp; }