6ade82f7d15690492425b8b5aec2b15a3103b0ea
kate
  Mon Feb 3 13:46:48 2014 -0800
Fix problem with missing Description section (occured when factor is missing from motifTarget table.  refs #9092
diff --git src/hg/hgc/peakClusters.c src/hg/hgc/peakClusters.c
index a94aaf5..148e4ed 100644
--- src/hg/hgc/peakClusters.c
+++ src/hg/hgc/peakClusters.c
@@ -388,31 +388,35 @@
     struct sqlResult *sr;
     int rowOffset;
     char where[256];
 
     if (motifMapTable == NULL || !sqlTableExists(conn, motifMapTable))
         {
         // Assume cluster name is motif name if there is no map table
         motifNames = slNameNew(cluster->name);
         }
     else
         {
         sqlSafef(query, sizeof(query),
                 "select motif from %s where target = '%s'", motifMapTable, cluster->name);
         char *ret = sqlQuickString(conn, query);
         if (ret == NULL)
+            {
+            // missing target from table -- no canonical motif
+            webNewEmptySection();
             return;
+            }
         motifNames = slNameListFromString(ret, ',');
         }
     for (mn = motifNames; mn != NULL; mn = mn->next)
         {
         sqlSafefFrag(where, sizeof(where), "name='%s' order by score desc limit 1", mn->name);
         sr = hRangeQuery(conn, motifTable, cluster->chrom, cluster->chromStart,
                      cluster->chromEnd, where, &rowOffset);
         if ((row = sqlNextRow(sr)) != NULL)
             {
             hit = bed6FloatScoreLoad(row + rowOffset);
             if (maxHit == NULL || maxHit->score < hit->score)
                 maxHit = hit;
             }
         sqlFreeResult(&sr);
         }