Bug 8206: Prevent decr follower next index beyong -1
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / FollowerLogInformationImpl.java
index c89996730694844cb2e35bb7ab333898e47e4345..883bfbb4e4184f0cbf0843002dfa3498ca13f622 100644 (file)
@@ -66,8 +66,13 @@ public class FollowerLogInformationImpl implements FollowerLogInformation {
     }
 
     @Override
-    public long decrNextIndex() {
-        return nextIndex--;
+    public boolean decrNextIndex() {
+        if (nextIndex >= 0) {
+            nextIndex--;
+            return true;
+        }
+
+        return false;
     }
 
     @Override