Protect against dereferencing null pointer, was crashing on Linux

This commit is contained in:
MarkRivers
2013-12-20 05:10:10 +00:00
parent f16799219c
commit 57c3afb8be
+3 -2
View File
@@ -175,8 +175,9 @@ STATIC RTN_STATUS PM304_build_trans(motor_cmnd command, double *parms, struct mo
rtnval = OK;
buff[0] = '\0';
dval = parms[0];
ival = NINT(parms[0]);
/* Protect against NULL pointer with WRTITE_MSG(GO/STOP_AXIS/GET_INFO, NULL). */
dval = (parms == NULL) ? 0.0 : *parms;
ival = NINT(dval);
motor_call = &(trans->motor_call);
card = motor_call->card;