Can handle unknown messages

FossilOrigin-Name: 189731bb4dae23486840ea02ba738a3eb8bad3dd58b184a89e9d3a5fbef3ff00
This commit is contained in:
7u83@mail.ru
2018-02-26 22:14:32 +00:00
parent 4dd1c09b31
commit f0e838de0a
4 changed files with 25 additions and 11 deletions

View File

@ -492,10 +492,14 @@ void cw_dbg_msg(int level, struct conn *conn, uint8_t * packet, int len,
search.type = msg_id;
struct cw_MsgData * message;
message = mavl_get(conn->msgset->messages,&search);
char * msname;
if (!message)
msname="Unknown";
else
msname = message->name;
s += sprintf(s, "%s Message (type=%d) ", message->name /*cw_strmsg(msg_id)*/, msg_id);
s += sprintf(s, "%s Message (type=%d) ", msname /*cw_strmsg(msg_id)*/, msg_id);
if (level == DBG_MSG_IN)
s += sprintf(s, "from %s ", sock_addr2str(from));
else