01badfbaa97a6547c7b938f79d48e454f1f09dce
braney
  Wed May 6 14:23:26 2026 -0700
hgc bigBed: only emit <BR> and set found after passing all filters, refs #36335

diff --git src/hg/hgc/bigBedClick.c src/hg/hgc/bigBedClick.c
index 97023a9a923..e3e8914835b 100644
--- src/hg/hgc/bigBedClick.c
+++ src/hg/hgc/bigBedClick.c
@@ -448,33 +448,30 @@
 /* Find particular item in list - matching start, and item if possible. */
 boolean found = FALSE;
 boolean firstTime = TRUE;
 struct bigBedInterval *bb;
 for (bb = bbList; bb != NULL; bb = bb->next)
     {
     if (bedSize > 3)
 	{
 	char *name = cloneFirstWordByDelimiterNoSkip(bb->rest, '\t');
 	boolean match = (isEmpty(name) && isEmpty(item)) || sameOk(name, item);
 	freez(&name);
 	if (!match)
 	    continue;
 	}
 
-    found = TRUE;
-    if (firstTime)
-	printf("<BR>\n");
     int seq1Seq2Fields = 0;
     // check for seq1 and seq2 in columns 7+8 (eg, pairedTagAlign)
     boolean seq1Seq2 = sameOk(trackDbSetting(tdb, BASE_COLOR_USE_SEQUENCE), "seq1Seq2");
     if (seq1Seq2 && bedSize == 6)
 	seq1Seq2Fields = 2;
     char *fields[bedSize+seq1Seq2Fields];
     char startBuf[16], endBuf[16];
     char *rest = cloneString(bb->rest);
     char *restFields[256];
     int restCount = 0;
     int restBedFields = 0;
     char **extraFields = NULL;
     int extraFieldCount = 0;
     struct slPair *extraFieldPairs = NULL;
     if (isNotEmpty(rest))
@@ -498,30 +495,37 @@
     struct bed *bed = NULL;
     if (quickLiftFile)
         {
         if ((bed = quickLiftIntervalsToBed(bbi, chainHash, bb)) == NULL)
             continue;
         }
     else
         {
         bed = bedLoadN(fields, bedSize);
         }
     if ((bed == NULL) || (bedSize >= 6 && scoreFilter && bed->score < minScore))
         continue;
     if (!(bed->chromStart == start && bed->chromEnd == end))
 	continue;
 
+    found = TRUE;
+    if (firstTime)
+	{
+	printf("<BR>\n");
+	firstTime = FALSE;
+	}
+
     // if there are extra fields, load them up because we may want to use them in URL:
     itemForUrl = getIdInUrl(tdb, item);
     printCustomUrlWithFields(tdb, bed->name, bed->name, item == itemForUrl, extraFieldPairs);
     if (itemForUrl)
         printIframe(tdb, itemForUrl);
 
     bedPrintPos(bed, bedSize, tdb);
 
     // display seq1 and seq2
     if (seq1Seq2 && bedSize+seq1Seq2Fields == 8)
         printf("<table><tr><th>Sequence 1</th><th>Sequence 2</th></tr>"
             "<tr><td> %s </td><td> %s </td></tr></table>", fields[6], fields[7]);
     else if (restCount > 0)
         {
         if (restCount > restBedFields)