added warning for null packets

This commit is contained in:
fros4943 2007-04-23 08:25:50 +00:00
parent 69952696fa
commit 1c818c039f

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: AbstractRadioMedium.java,v 1.1 2007/03/23 21:05:45 fros4943 Exp $ * $Id: AbstractRadioMedium.java,v 1.2 2007/04/23 08:25:50 fros4943 Exp $
*/ */
package se.sics.cooja.radiomediums; package se.sics.cooja.radiomediums;
@ -114,6 +114,10 @@ public abstract class AbstractRadioMedium extends RadioMedium {
*/ */
public void forwardPacket(RadioConnection connection, byte[] packetData) { public void forwardPacket(RadioConnection connection, byte[] packetData) {
Radio sourceRadio = connection.getSource(); Radio sourceRadio = connection.getSource();
if (packetData == null || packetData.length == 0) {
logger.warn("Trying to forward null packet");
return;
}
if (sourceRadio instanceof ByteRadio) { if (sourceRadio instanceof ByteRadio) {
// Byte radios only forwards packets to packet radios // Byte radios only forwards packets to packet radios