X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=apps%2FAntiTheft%2FRoot%2FAntiTheftRootC.nc;h=896bc812a89d332afbeda66a391cc993f026316a;hb=da0cfeda9689aa64cfce0aa209f51803dcb11c21;hp=7a9a2630a5f1943de48676fb9dd22847e2bb3cbc;hpb=594acbf436f5f78611348f7763a89c84f38ba46a;p=tinyos-2.x.git diff --git a/apps/AntiTheft/Root/AntiTheftRootC.nc b/apps/AntiTheft/Root/AntiTheftRootC.nc index 7a9a2630..896bc812 100644 --- a/apps/AntiTheft/Root/AntiTheftRootC.nc +++ b/apps/AntiTheft/Root/AntiTheftRootC.nc @@ -93,11 +93,12 @@ implementation { /* Copy payload (newAlert) from collection system to our serial message buffer (fwdAlert), then send our serial message */ - alert_t *fwdAlert = call AlertsForward.getPayload(&fwdMsg); - - *fwdAlert = *newAlert; - if (call AlertsForward.send(AM_BROADCAST_ADDR, &fwdMsg, sizeof *fwdAlert) == SUCCESS) - fwdBusy = TRUE; + alert_t *fwdAlert = call AlertsForward.getPayload(&fwdMsg, sizeof(alert_t)); + if (fwdAlert != NULL) { + *fwdAlert = *newAlert; + if (call AlertsForward.send(AM_BROADCAST_ADDR, &fwdMsg, sizeof *fwdAlert) == SUCCESS) + fwdBusy = TRUE; + } } return msg; }