]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - apps/AntiTheft/Nodes/AntiTheftC.nc
The big interface switchover for Packet, Send, Receive, and AMSend.
[tinyos-2.x.git] / apps / AntiTheft / Nodes / AntiTheftC.nc
index 8696be00e094e332c7102c47b7b619bf02578151..6245b6d9de6a9d4771b2c2ba14df21dfc060ceea 100644 (file)
@@ -103,11 +103,12 @@ implementation
        /* Report the identity of this node, using the collection protocol */
 
        /* Get the payload part of alertMsg and fill in our data */
-       alert_t *newAlert = call AlertRoot.getPayload(&alertMsg);
-       newAlert->stolenId = TOS_NODE_ID;
-
-       /* and send it... */
-       check(call AlertRoot.send(&alertMsg, sizeof *newAlert));
+       alert_t *newAlert = call AlertRoot.getPayload(&alertMsg, sizeof(alert_t));
+       if (newAlert != NULL) {
+         newAlert->stolenId = TOS_NODE_ID;
+         /* and send it... */
+         check(call AlertRoot.send(&alertMsg, sizeof *newAlert));
+       }
       }
   }