Check for attributeList is NULL in ConstructTupleDescriptor ().

Submitted by Raymond Toy.
This commit is contained in:
Vadim B. Mikheev 1997-04-05 03:36:21 +00:00
parent 3ded1cc530
commit 50faf40903
1 changed files with 8 additions and 4 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.14 1997/03/27 04:13:44 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.15 1997/04/05 03:36:21 vadim Exp $
*
*
* INTERFACE ROUTINES
@ -369,9 +369,13 @@ ConstructTupleDescriptor(Oid heapoid,
if (atnum > natts)
elog(WARN, "Cannot create index: attribute %d does not exist",
atnum);
IndexKey = (IndexElem*) lfirst(attributeList);
attributeList = lnext(attributeList);
IndexKeyType = IndexKey->tname;
if (attributeList) {
IndexKey = (IndexElem*) lfirst(attributeList);
attributeList = lnext(attributeList);
IndexKeyType = IndexKey->tname;
} else {
IndexKeyType = NULL;
}
indexTupDesc->attrs[i] = (AttributeTupleForm) palloc(ATTRIBUTE_TUPLE_SIZE);