Skip to content

Commit 50faf40

Browse files
committed
Check for attributeList is NULL in ConstructTupleDescriptor ().
Submitted by Raymond Toy.
1 parent 3ded1cc commit 50faf40

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/backend/catalog/index.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.14 1997/03/27 04:13:44 vadim Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.15 1997/04/05 03:36:21 vadim Exp $
1111
*
1212
*
1313
* INTERFACE ROUTINES
@@ -369,9 +369,13 @@ ConstructTupleDescriptor(Oid heapoid,
369369
if (atnum > natts)
370370
elog(WARN, "Cannot create index: attribute %d does not exist",
371371
atnum);
372-
IndexKey = (IndexElem*) lfirst(attributeList);
373-
attributeList = lnext(attributeList);
374-
IndexKeyType = IndexKey->tname;
372+
if (attributeList) {
373+
IndexKey = (IndexElem*) lfirst(attributeList);
374+
attributeList = lnext(attributeList);
375+
IndexKeyType = IndexKey->tname;
376+
} else {
377+
IndexKeyType = NULL;
378+
}
375379

376380
indexTupDesc->attrs[i] = (AttributeTupleForm) palloc(ATTRIBUTE_TUPLE_SIZE);
377381

0 commit comments

Comments
 (0)