From 1b2647858c2f9eb4c16336f1b690db9947c0c326 Mon Sep 17 00:00:00 2001 From: satyam Date: Mon, 27 May 2019 07:21:01 +0530 Subject: [PATCH] Remove inconsistency of the index value --- .../modules/TransferManager/LTM/LockUpTransferManager.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/modules/TransferManager/LTM/LockUpTransferManager.sol b/contracts/modules/TransferManager/LTM/LockUpTransferManager.sol index 22c40da48..c502f8241 100644 --- a/contracts/modules/TransferManager/LTM/LockUpTransferManager.sol +++ b/contracts/modules/TransferManager/LTM/LockUpTransferManager.sol @@ -550,7 +550,7 @@ contract LockUpTransferManager is LockUpTransferManagerStorage, TransferManager // delete the user from the lockup type uint256 _lockupIndex = lockupToUserIndex[_lockupName][_userAddress]; uint256 _len = lockupToUsers[_lockupName].length; - if ( _lockupIndex != _len) { + if ( _lockupIndex != _len - 1) { lockupToUsers[_lockupName][_lockupIndex] = lockupToUsers[_lockupName][_len - 1]; lockupToUserIndex[_lockupName][lockupToUsers[_lockupName][_lockupIndex]] = _lockupIndex; } @@ -560,7 +560,7 @@ contract LockUpTransferManager is LockUpTransferManagerStorage, TransferManager // delete the lockup from the user uint256 _userIndex = userToLockupIndex[_userAddress][_lockupName]; _len = userToLockups[_userAddress].length; - if ( _userIndex != _len) { + if ( _userIndex != _len - 1) { userToLockups[_userAddress][_userIndex] = userToLockups[_userAddress][_len - 1]; userToLockupIndex[_userAddress][userToLockups[_userAddress][_userIndex]] = _userIndex; }