summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Carbonneaux2012-03-17 22:37:15 +0100
committerQuentin Carbonneaux2012-03-17 22:37:15 +0100
commit9ec61b4072285e36baeab8f1ac6d819f9445b56c (patch)
tree7ca33bcb8990c8596513ec250e2859a2381d8aef
parent15ec7fd992fc9943740da3d90aec084e13b4392e (diff)
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.
-rw-r--r--irc.c2
1 files changed, 1 insertions, 1 deletions
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, " ");