diff options
author | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2013-04-10 16:09:08 +0200 |
---|---|---|
committer | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2013-04-10 16:09:08 +0200 |
commit | 8cf27972c87572e9b256e00a226fdaf275a1a43e (patch) | |
tree | f5492f21b2cba1515a7a0a8c7025b0838b79dde3 /src/main.c | |
parent | 42a9fabacefc5595cc37448e6493fa51f1b75bf5 (diff) | |
download | ratpoison-8cf27972c87572e9b256e00a226fdaf275a1a43e.zip |
strtok_ws: account for erroneous usage
* if s and last are both NULL then we'll get a fatal error;
instead of waiting for the segfault, display an error message
and call abort()
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -171,8 +171,13 @@ strtok_ws (char *s) char *nonws; static char *last = NULL; - if (s) + if (s == NULL) last = s; + else if (last == NULL) + { + PRINT_ERROR (("strtok_ws() called but not initalized, this is a *BUG*\n")); + abort(); + } /* skip to first non-whitespace char. */ while (*last && isspace (*last)) last++; |