d7228ab745723e138b488ee17384286c09c60469
braney
  Fri May 27 14:41:09 2022 -0700
watch out for NULL when looking into aliases

diff --git src/hg/hgTracks/imageV2.c src/hg/hgTracks/imageV2.c
index 7ac56a3..8fdbdb6 100644
--- src/hg/hgTracks/imageV2.c
+++ src/hg/hgTracks/imageV2.c
@@ -1371,31 +1371,37 @@
 
 long positionWidth = (long)((imgBox->portalEnd - imgBox->portalStart) * imageMultiple);
 *chromStart = imgBox->portalStart - (long)(  ((imageMultiple - 1)/2)
                                           * (imgBox->portalEnd - imgBox->portalStart));
 if (*chromStart < 0)
     *chromStart = 0;
 *chromEnd = *chromStart + positionWidth;
 // get chrom size
 long virtChromSize = 0;
 if (sameString(imgBox->chrom, MULTI_REGION_VIRTUAL_CHROM_NAME))
     {
     virtChromSize = virtSeqBaseCount;
     }
 else
     {
-    struct chromInfo *chrInfo = hGetChromInfo(imgBox->db,chromAliasFindNative(imgBox->chrom));
+    struct chromInfo *chrInfo = hGetChromInfo(imgBox->db,imgBox->chrom);
+    if (chrInfo == NULL)
+        {
+        char *native = chromAliasFindNative(imgBox->chrom);
+        if (native != NULL)
+            chrInfo = hGetChromInfo(imgBox->db, native);
+        }
     if (chrInfo == NULL)
 	{
 	*chromStart = imgBox->chromStart;
 	*chromEnd   = imgBox->chromEnd;
 	return FALSE;
 	}
     virtChromSize = chrInfo->size;
     }
 if (*chromEnd > virtChromSize)  // Bound by chrom length
     {
     *chromEnd = virtChromSize;
     *chromStart = *chromEnd - positionWidth;
     if (*chromStart < 0)
         *chromStart = 0;
     }