Return DISP_E_DIVBYZERO instead of crashing when asked to divide a

variant by zero.
This commit is contained in:
Daniel Remenak 2005-04-12 10:15:56 +00:00 committed by Alexandre Julliard
parent 7376f57c30
commit 292b61f550
1 changed files with 2 additions and 0 deletions

View File

@ -3008,11 +3008,13 @@ HRESULT WINAPI VarDiv(LPVARIANT left, LPVARIANT right, LPVARIANT result)
}
switch (resvt) {
case VT_R8:
if (V_R8(&rv) == 0) return DISP_E_DIVBYZERO;
V_VT(result) = resvt;
V_R8(result) = V_R8(&lv) / V_R8(&rv);
rc = S_OK;
break;
case VT_I4:
if (V_I4(&rv) == 0) return DISP_E_DIVBYZERO;
V_VT(result) = resvt;
V_I4(result) = V_I4(&lv) / V_I4(&rv);
rc = S_OK;