Fix minor crash with nil pointer argument.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21294 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2005-06-08 05:19:29 +00:00
parent 3906a84a05
commit 433e72bc8d
2 changed files with 13 additions and 6 deletions

View file

@ -1,3 +1,8 @@
2005-06-08 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSCalendardate.m: Fix crash when a nil string is passed to
initWithString... methods.
2005-06-06 Adam Fedor <fedor@gnu.org>
* Source/Makefile.preamble: Add objc lib on all platforms

View file

@ -600,8 +600,8 @@ static inline int getDigits(const char *from, char *to, int limit)
BOOL ampm = NO;
BOOL twelveHrClock = NO;
int julianWeeks = -1, weekStartsMonday = 0, dayOfWeek = -1;
const char *source = [description cString];
unsigned sourceLen = strlen(source);
const char *source;
unsigned sourceLen;
unichar *format;
unsigned formatLen;
unsigned formatIdx = 0;
@ -615,6 +615,12 @@ static inline int getDigits(const char *from, char *to, int limit)
BOOL changedFormat = NO;
BOOL error = NO;
if (description == nil)
{
description = @"";
}
source = [description cString];
sourceLen = strlen(source);
if (locale == nil)
{
locale = GSUserDefaultsDictionaryRepresentation();
@ -627,10 +633,6 @@ static inline int getDigits(const char *from, char *to, int limit)
fmt = @"";
}
}
if (description == nil)
{
description = @"";
}
/*
* Get format into a buffer, leaving room for expansion in case it has