Fix illegal pointer reference for empty string

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27094 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2008-11-19 12:18:28 +00:00
parent 8d24f343e8
commit 118ee4598a
2 changed files with 4 additions and 3 deletions

View file

@ -8,6 +8,7 @@
after SSL or SOCKS module has dealt with them.
* Source/GSStream.h: New method to reset sent events mask
* Source/GSStream.m: ditto
* Source/GSString.m: Fix nil pointer reference
2008-11-18 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -1489,7 +1489,7 @@ doubleValue_c(GSStr self)
const char *ptr = (const char*)self->_contents.c;
const char *end = ptr + self->_count;
while (isspace(*ptr) && ptr < end)
while (ptr < end && isspace(*ptr))
{
ptr++;
}
@ -1981,7 +1981,7 @@ intValue_c(GSStr self)
const char *ptr = (const char*)self->_contents.c;
const char *end = ptr + self->_count;
while (isspace(*ptr) && ptr < end)
while (ptr < end && isspace(*ptr))
{
ptr++;
}
@ -2006,7 +2006,7 @@ intValue_u(GSStr self)
const unichar *ptr = self->_contents.u;
const unichar *end = ptr + self->_count;
while (isspace(*ptr) && ptr < end)
while (ptr < end && isspace(*ptr))
{
ptr++;
}