Fix for case where cross ref array is not initialised at all.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21380 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2005-06-30 08:32:07 +00:00
parent 9b8bcaa3e6
commit 20887bf59c

View file

@ -536,18 +536,24 @@ deserializeFromInfo(_NSDeserializerInfo* info)
switch (code)
{
case ST_XREF:
{
size = (*info->deiImp)(info->data, deiSel, info->cursor);
if (size < GSIArrayCount(&info->array))
{
return RETAIN(GSIArrayItemAtIndex(&info->array, size).obj);
}
else
{
[NSException raise: NSInvalidArgumentException
format: @"Bad cross reference in property list"];
}
}
if (info->didUnique)
{
size = (*info->deiImp)(info->data, deiSel, info->cursor);
if (size < GSIArrayCount(&info->array))
{
return RETAIN(GSIArrayItemAtIndex(&info->array, size).obj);
}
else
{
[NSException raise: NSInvalidArgumentException
format: @"Bad cross reference in property list"];
}
}
else
{
[NSException raise: NSInvalidArgumentException
format: @"Unexpected cross reference in property list"];
}
case ST_CSTRING:
{
@ -564,14 +570,18 @@ deserializeFromInfo(_NSDeserializerInfo* info)
* If we are supposed to be doing uniquing of strings, handle it.
*/
if (uniquing == YES)
s = GSUnique(s);
{
s = GSUnique(s);
}
/*
* If uniquing was done on serialisation, store the string for
* later reference.
*/
if (info->didUnique)
GSIArrayAddItem(&info->array, (GSIArrayItem)s);
{
GSIArrayAddItem(&info->array, (GSIArrayItem)s);
}
return s;
}
@ -618,14 +628,18 @@ deserializeFromInfo(_NSDeserializerInfo* info)
* If we are supposed to be doing uniquing of strings, handle it.
*/
if (uniquing == YES)
s = GSUnique(s);
{
s = GSUnique(s);
}
/*
* If uniquing was done on serialisation, store the string for
* later reference.
*/
if (info->didUnique)
GSIArrayAddItem(&info->array, (GSIArrayItem)s);
{
GSIArrayAddItem(&info->array, (GSIArrayItem)s);
}
return s;
}
@ -751,8 +765,9 @@ deserializeFromInfo(_NSDeserializerInfo* info)
}
default:
return nil;
break;
}
return nil;
}