Fixes PVE002

This commit is contained in:
emilio 2020-10-19 15:40:19 +02:00
parent e0f5c5fb7f
commit b57a59ea6d

View File

@ -78,6 +78,10 @@ library WadRayMath {
function wadDiv(uint256 a, uint256 b) internal pure returns (uint256) { function wadDiv(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, Errors.DIVISION_BY_ZERO); require(b != 0, Errors.DIVISION_BY_ZERO);
if (a == 0) {
return 0;
}
uint256 halfB = b / 2; uint256 halfB = b / 2;
uint256 result = a * WAD; uint256 result = a * WAD;
@ -98,7 +102,7 @@ library WadRayMath {
* @return the result of a*b, in ray * @return the result of a*b, in ray
**/ **/
function rayMul(uint256 a, uint256 b) internal pure returns (uint256) { function rayMul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) { if (a == 0 || b == 0) {
return 0; return 0;
} }
@ -122,6 +126,10 @@ library WadRayMath {
function rayDiv(uint256 a, uint256 b) internal pure returns (uint256) { function rayDiv(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, Errors.DIVISION_BY_ZERO); require(b != 0, Errors.DIVISION_BY_ZERO);
if (a == 0) {
return 0;
}
uint256 halfB = b / 2; uint256 halfB = b / 2;
uint256 result = a * RAY; uint256 result = a * RAY;