499eb9facae2cd13591dad0256751b9742aa1bea
angie
  Thu Aug 17 09:52:36 2017 -0700
Added asColumnMustFindIx.  Use it in hgVai in places where columns are expected to never go away, instead of risking that they do go away and we access row[-1].  Thx Jonathan.  refs #19992 note-13

diff --git src/lib/asParse.c src/lib/asParse.c
index 9747613..e8ae8b3 100644
--- src/lib/asParse.c
+++ src/lib/asParse.c
@@ -557,30 +557,40 @@
 return asCol;
 }
 
 int asColumnFindIx(struct asColumn *list, char *name)
 /* Return index of first element of asColumn list that matches name.
  * Return -1 if not found. */
 {
 struct asColumn *ac;
 int ix = 0;
 for (ac = list; ac != NULL; ac = ac->next, ix++)
     if (sameString(name, ac->name))
         return ix;
 return -1;
 }
 
+int asColumnMustFindIx(struct asColumn *list, char *name)
+/* Return index of first element of asColumn list that matches name.
+ * errAbort if not found. */
+{
+int ix = asColumnFindIx(list, name);
+if (ix < 0)
+    errAbort("asColumnMustFindIx: cannot find column \"%s\" in list", name);
+return ix;
+}
+
 boolean asCompareObjs(char *name1, struct asObject *as1, char *name2, struct asObject *as2, int numColumnsToCheck,
  int *retNumColumnsSame, boolean abortOnDifference)
 /* Compare as-objects as1 and as2 making sure several important fields show they are the same name and type.
  * If difference found, print it to stderr.  If abortOnDifference, errAbort.
  * Othewise, return TRUE if the objects columns match through the first numColumnsToCheck fields. 
  * If retNumColumnsSame is not NULL, then it will be set to the number of contiguous matching columns. */
 {
 boolean differencesFound = FALSE;
 struct asColumn *col1 = as1->columnList, *col2 = as2->columnList;
 int checkCount = 0;
 int verboseLevel = 2;
 if (abortOnDifference)
     verboseLevel = 1;
 if (as1->isTable != as2->isTable)
     {