From 123c612614b2a0e02f9b2dd8f8466ecc50ea6c47 Mon Sep 17 00:00:00 2001 From: joxe Date: Sat, 23 Jan 2010 11:26:32 +0000 Subject: [PATCH] only deliver packets that are not null to app mote --- .../java/se/sics/cooja/motes/AbstractApplicationMote.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/motes/AbstractApplicationMote.java b/tools/cooja/java/se/sics/cooja/motes/AbstractApplicationMote.java index e00df375c..72c9d65b3 100644 --- a/tools/cooja/java/se/sics/cooja/motes/AbstractApplicationMote.java +++ b/tools/cooja/java/se/sics/cooja/motes/AbstractApplicationMote.java @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: AbstractApplicationMote.java,v 1.7 2009/11/27 15:53:10 fros4943 Exp $ + * $Id: AbstractApplicationMote.java,v 1.8 2010/01/23 11:26:32 joxe Exp $ */ package se.sics.cooja.motes; @@ -72,7 +72,9 @@ public abstract class AbstractApplicationMote extends AbstractWakeupMote impleme public void update(Observable obs, Object obj) { ApplicationRadio radio = (ApplicationRadio) obs; if (radio.getLastEvent() == Radio.RadioEvent.RECEPTION_FINISHED) { - receivedPacket(radio.getLastPacketReceived()); + /* only send in packets when they exist */ + if (radio.getLastPacketReceived() != null) + receivedPacket(radio.getLastPacketReceived()); } else if (radio.getLastEvent() == Radio.RadioEvent.TRANSMISSION_FINISHED) { sentPacket(radio.getLastPacketTransmitted()); }