print a warning if developer >= 1 and return 0.0 as result of the operation.
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6532
d7cf8633-e32d-0410-b094-
e92efae38249
OPC->vector[2] = OPB->_float * OPA->vector[2];
break;
case OP_DIV_F:
- OPC->_float = OPA->_float / OPB->_float;
+ if( OPB->_float != 0.0f )
+ {
+ OPC->_float = OPA->_float / OPB->_float;
+ }
+ else
+ {
+ if( developer.integer >= 1 ) {
+ VM_Warning( "Attempted division by zero in %s\n", PRVM_NAME );
+ }
+ OPC->_float = 0.0f;
+ }
break;
case OP_BITAND:
OPC->_float = (int)OPA->_float & (int)OPB->_float;