diff --git a/contracts/utils/contracts/src/LibSafeMath.sol b/contracts/utils/contracts/src/LibSafeMath.sol index dd985cc751..892603b15b 100644 --- a/contracts/utils/contracts/src/LibSafeMath.sol +++ b/contracts/utils/contracts/src/LibSafeMath.sol @@ -30,6 +30,13 @@ library LibSafeMath { pure returns (uint256) { + if (b == 0) { + LibRichErrors._rrevert(LibSafeMathRichErrors.SafeMathError( + LibSafeMathRichErrors.SafeMathErrorCodes.UINT256_DIVISION_BY_ZERO, + a, + b + )); + } uint256 c = a / b; return c; }