]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - apps/tests/TestSerialBandwidth/TestSerialC.nc
The big interface switchover for Packet, Send, Receive, and AMSend.
[tinyos-2.x.git] / apps / tests / TestSerialBandwidth / TestSerialC.nc
index b361e3ab62066a75ef28e45dcab562ce7e4121f7..671210b3846bdcf395fd46e8eb632b01878dd71b 100644 (file)
@@ -83,8 +83,8 @@ implementation {
       return;
     }
     else {
-      TestSerialMsg* rcm = (TestSerialMsg*)call Packet.getPayload(&packet, NULL);
-      if (call Packet.maxPayloadLength() < sizeof(TestSerialMsg)) {
+      TestSerialMsg* rcm = (TestSerialMsg*)call Packet.getPayload(&packet, sizeof(TestSerialMsg));
+      if (rcm == NULL || call Packet.maxPayloadLength() < sizeof(TestSerialMsg)) {
        return;
       }
 
@@ -128,7 +128,10 @@ implementation {
       locked = FALSE;
       // as fast as possible
       if (afap){
-        TestSerialMsg* rcm = (TestSerialMsg*)call Packet.getPayload(&packet,NULL);
+        TestSerialMsg* rcm = (TestSerialMsg*)call Packet.getPayload(&packet, sizeof(TestSerialMsg));
+       if (rcm == NULL || call Packet.payloadLength(&packet) != sizeof(TestSerialMsg)) {
+         return;
+       }
         counter++;
         rcm->counter = counter;
         call Leds.led0Toggle();