Fix uparse to deal explicitely with empty lines. - irc - IRC client based on c9x.me/irc client
HTML git clone git://git.codemadness.org/irc
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 9ec61b4072285e36baeab8f1ac6d819f9445b56c
DIR parent 15ec7fd992fc9943740da3d90aec084e13b4392e
HTML Author: Quentin Carbonneaux <qcarbonneaux@gmail.com>
Date: Sat, 17 Mar 2012 22:37:15 +0100
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.
Diffstat:
M irc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
DIR diff --git 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, " ");