From a8838d7b17f5e8ab1b5d3fb16ac5e1ea89fc5f03 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Thu, 26 Feb 2009 13:45:58 +0000 Subject: [PATCH] make sure node interfaces are initialized when generating toString() --- .../java/se/sics/cooja/contikimote/ContikiMote.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/contikimote/ContikiMote.java b/tools/cooja/java/se/sics/cooja/contikimote/ContikiMote.java index 9bb2b012c..7e84c8443 100644 --- a/tools/cooja/java/se/sics/cooja/contikimote/ContikiMote.java +++ b/tools/cooja/java/se/sics/cooja/contikimote/ContikiMote.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ContikiMote.java,v 1.9 2008/12/04 14:03:42 joxe Exp $ + * $Id: ContikiMote.java,v 1.10 2009/02/26 13:45:58 fros4943 Exp $ */ package se.sics.cooja.contikimote; @@ -310,11 +310,13 @@ public class ContikiMote implements Mote { } public String toString() { - if (getInterfaces().getMoteID() != null) { - return "Contiki Mote, ID=" + getInterfaces().getMoteID().getMoteID(); - } else { + if (getInterfaces() == null) { + return "Contiki Mote"; + } + if (getInterfaces().getMoteID() == null) { return "Contiki Mote, ID=null"; } + return "Contiki Mote, ID=" + getInterfaces().getMoteID().getMoteID(); } }