diff --git a/contracts/namespaces/TokenHandleRegistry.sol b/contracts/namespaces/TokenHandleRegistry.sol index a9393a3..a32d237 100644 --- a/contracts/namespaces/TokenHandleRegistry.sol +++ b/contracts/namespaces/TokenHandleRegistry.sol @@ -176,6 +176,9 @@ contract TokenHandleRegistry is ITokenHandleRegistry { } function _unlink(uint256 handleId, uint256 profileId, address transactionExecutor) private { + if (handleId == 0 || profileId == 0) { + revert RegistryErrors.DoesNotExist(); + } if ( ILensHandles(LENS_HANDLES).exists(handleId) && ILensHandles(LENS_HANDLES).ownerOf(handleId) != transactionExecutor && diff --git a/test/namespaces/TokenHandleRegistryTest.t.sol b/test/namespaces/TokenHandleRegistryTest.t.sol index 663512b..ce40507 100644 --- a/test/namespaces/TokenHandleRegistryTest.t.sol +++ b/test/namespaces/TokenHandleRegistryTest.t.sol @@ -112,16 +112,16 @@ contract TokenHandleRegistryTest is BaseTest { assertEq(tokenHandleRegistry.resolve(handleId), profileId); assertEq(tokenHandleRegistry.getDefaultHandle(profileId), handleId); - vm.expectRevert(RegistryErrors.NotLinked.selector); + vm.expectRevert(RegistryErrors.DoesNotExist.selector); vm.prank(otherAddress); tokenHandleRegistry.unlink(handleId, 0); - vm.expectRevert(RegistryErrors.NotLinked.selector); + vm.expectRevert(RegistryErrors.DoesNotExist.selector); vm.prank(otherAddress); tokenHandleRegistry.unlink(0, profileId); console.log('0, 0'); - vm.expectRevert(RegistryErrors.NotLinked.selector); + vm.expectRevert(RegistryErrors.DoesNotExist.selector); vm.prank(otherAddress); tokenHandleRegistry.unlink(0, 0); }