dec7900a42fb984be16142c1f090c71cbe09ff05
braney
  Thu May 14 17:41:48 2026 -0700
fix genePred.c not to crash if there are no exon frames when flipping strands refs #36370

diff --git src/hg/lib/genePred.c src/hg/lib/genePred.c
index 26f4d2ebb38..4410902f9f1 100644
--- src/hg/lib/genePred.c
+++ src/hg/lib/genePred.c
@@ -2109,30 +2109,36 @@
 
 if (isCoding != NULL && codingBasesSoFar > 0)
     {
     *isCoding = FALSE;
     return codingBasesSoFar;
     }
 return -1;  // introns not okay
 }
 
 void genePredReverseFrames(struct genePred *gp)
 // Reverse exon frames for this genePred
 {
 if (gp->exonCount == 1)
     return;
 
+// genePredLoad (12-column knownGene-style rows) does not populate
+// exonFrames; callers that lift such a genePred can still trigger a
+// strand flip and reach here.  Nothing to reverse in that case.
+if (gp->exonFrames == NULL)
+    return;
+
 int *reorderFrames;
 AllocArray(reorderFrames, gp->exonCount);
 
 int ii;
 for(ii=0; ii < gp->exonCount; ii++)
     reorderFrames[ii] = gp->exonFrames[(gp->exonCount - 1) - ii];
 
 gp->exonFrames = reorderFrames;
 }
 
 struct genePredExt  *genePredFromBedBigGenePred( char *chrom, struct bed *bed, struct bigBedInterval *bb, boolean changedStrand)
 /* build a genePred from a bigGenePred and a bed file */
 {
 char *extra = cloneString(bb->rest);
 int numCols = 12 + 8 - 3;