From 9ec61b4072285e36baeab8f1ac6d819f9445b56c Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Sat, 17 Mar 2012 22:37:15 +0100 Subject: Fix uparse to deal explicitely with empty lines. Uparse accessed undefined elements if the input line was empty. This was harmless because the default branch of the switch led the control flow to the right place, however it could appear a bit obscure. Adding an extra test will not hurt performance and make the code easier to read. --- irc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/irc.c b/irc.c index 9a5b4e5..872388f 100644 --- a/irc.c +++ b/irc.c @@ -265,7 +265,7 @@ uparse(char *m) { char *p=m; - if (p[1]!=' ' && p[1]!=0) { + if (!p[0] || (p[1]!=' ' && p[1]!=0)) { pmsg: if (ch==0) return; m+=strspn(m, " "); -- cgit v1.2.3