Avoid crashing if Rime/Chameleon is not initialized when Rime code is run

This commit is contained in:
adamdunkels 2008-07-03 23:13:31 +00:00
parent 51f4ab8b2c
commit cfcdac3122

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * 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 int
chameleon_hdrsize(const struct rimebuf_attrlist attrlist[]) chameleon_hdrsize(const struct rimebuf_attrlist attrlist[])
{ {
if(header_module != NULL &&
header_module->hdrsize != NULL) {
return header_module->hdrsize(attrlist); return header_module->hdrsize(attrlist);
} else {
return 0;
}
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/