Check for Zero Address

Added a require statement in the changeOwner function to ensure that the new owner is not set to the zero address. This prevents accidental loss of control over the contract.
pull/818/head
Ravi Tokas 5 months ago committed by Aniket
parent 34a45b8dc3
commit 5f5a7ce35f
  1. 1
      libs/remix-ws-templates/src/templates/remixDefault/contracts/2_Owner.sol

@ -40,6 +40,7 @@ contract Owner {
* @param newOwner address of new owner
*/
function changeOwner(address newOwner) public isOwner {
require(newOwner != address(0), "New owner should not be the zero address");
emit OwnerSet(owner, newOwner);
owner = newOwner;
}

Loading…
Cancel
Save