make sure node interfaces are initialized when generating toString()

This commit is contained in:
fros4943 2009-02-26 13:45:58 +00:00
parent c2279d6c81
commit a8838d7b17
1 changed files with 6 additions and 4 deletions

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: 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; package se.sics.cooja.contikimote;
@ -310,11 +310,13 @@ public class ContikiMote implements Mote {
} }
public String toString() { public String toString() {
if (getInterfaces().getMoteID() != null) { if (getInterfaces() == null) {
return "Contiki Mote, ID=" + getInterfaces().getMoteID().getMoteID(); return "Contiki Mote";
} else { }
if (getInterfaces().getMoteID() == null) {
return "Contiki Mote, ID=null"; return "Contiki Mote, ID=null";
} }
return "Contiki Mote, ID=" + getInterfaces().getMoteID().getMoteID();
} }
} }