log: add a null check and fix indentation

This commit is contained in:
Yasuyuki Tanaka 2017-09-14 21:48:08 +09:00
parent 78a4d60584
commit 3a1cfc6f3e

View File

@ -104,7 +104,7 @@ log_6addr(const uip_ipaddr_t *ipaddr)
} }
LOG_OUTPUT("%x", a); LOG_OUTPUT("%x", a);
} }
} }
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -171,6 +171,9 @@ int
log_get_level(const char *module) log_get_level(const char *module)
{ {
int i = 0; int i = 0;
if(module == NULL) {
return -1;
}
while(all_modules[i].name != NULL) { while(all_modules[i].name != NULL) {
if(!strcmp(module, all_modules[i].name)) { if(!strcmp(module, all_modules[i].name)) {
return *all_modules[i].curr_log_level; return *all_modules[i].curr_log_level;