Safety check: only try to read a packet if it was preceeded by an interrupt (which sets the pending flag)

This commit is contained in:
adamdunkels 2010-03-19 13:18:53 +00:00
parent 3a5be4a7e4
commit a3a8c0e179

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: cc2420.c,v 1.45 2010/03/16 18:10:09 adamdunkels Exp $
* @(#)$Id: cc2420.c,v 1.46 2010/03/19 13:18:53 adamdunkels Exp $
*/
/*
* This code is almost device independent and should be easy to port.
@ -631,6 +631,10 @@ cc2420_read(void *buf, unsigned short bufsize)
uint16_t checksum;
#endif /* CC2420_CONF_CHECKSUM */
if(!pending) {
return 0;
}
pending = 0;
GET_LOCK();