From cfcdac312233a5c4e2fa2126564d8efe573a4a87 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Thu, 3 Jul 2008 23:13:31 +0000 Subject: [PATCH] Avoid crashing if Rime/Chameleon is not initialized when Rime code is run --- core/net/rime/chameleon.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/net/rime/chameleon.c b/core/net/rime/chameleon.c index a5ef4e559..604d51bfe 100644 --- a/core/net/rime/chameleon.c +++ b/core/net/rime/chameleon.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: chameleon.c,v 1.3 2008/03/03 20:20:33 adamdunkels Exp $ + * $Id: chameleon.c,v 1.4 2008/07/03 23:13:31 adamdunkels Exp $ */ /** @@ -150,6 +150,11 @@ chameleon_output(struct channel *c) int chameleon_hdrsize(const struct rimebuf_attrlist attrlist[]) { - return header_module->hdrsize(attrlist); + if(header_module != NULL && + header_module->hdrsize != NULL) { + return header_module->hdrsize(attrlist); + } else { + return 0; + } } /*---------------------------------------------------------------------------*/