diff options
| author | Quentin Carbonneaux | 2012-03-17 22:37:15 +0100 |
|---|---|---|
| committer | Quentin Carbonneaux | 2012-03-17 22:37:15 +0100 |
| commit | 9ec61b4072285e36baeab8f1ac6d819f9445b56c (patch) | |
| tree | 7ca33bcb8990c8596513ec250e2859a2381d8aef | |
| parent | 15ec7fd992fc9943740da3d90aec084e13b4392e (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.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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, " "); |
