5acccb62470bd0455e12e892b34eb68fce6121fa larrym Thu Jul 19 12:10:50 2012 -0700 errAbort on missing organism; can happen in mirrors (see #8490) diff --git src/hg/hgc/rnaFoldClick.c src/hg/hgc/rnaFoldClick.c index fe557c6..c220356 100644 --- src/hg/hgc/rnaFoldClick.c +++ src/hg/hgc/rnaFoldClick.c @@ -143,46 +143,51 @@ mafColors[1] = LTPURPLE; /* not pairing, substitution */ mafColors[2] = BLACK; /* compatible with pairing */ mafColors[3] = BLUE; /* compatible with pairing, single substitution */ mafColors[4] = GREEN; /* compensatory change */ mafColors[5] = RED; /* not compatible with fold, single subs */ mafColors[6] = ORANGE; /* not compatible with fold, double subs */ mafColors[7] = MAGENTA; /* not compatible with fold, involves indel */ } char *hDbOrganism(char *databaseIn) /* Function to get organism from the genome db */ { struct sqlConnection *connCentral = hConnectCentral(); char buf[256]; char query[256]; -char *res; +char *res = NULL; char *database; char *chp; -database = strdup(databaseIn); +database = cloneString(databaseIn); // process special case like "hg19.chr21" chp = strstr(database, "."); if (chp != NULL) { *chp = '\0'; } safef(query, sizeof(query), "select organism from dbDb where name = '%s'", database); -res = strdup(sqlQuickQuery(connCentral, query, buf, sizeof(buf))); +if(sqlQuickQuery(connCentral, query, buf, sizeof(buf)) == NULL) + // this can happen in mirrors (see #8490). + errAbort("organism '%s' not found in dbDb", database); +else + res = cloneString(buf); hDisconnectCentral(&connCentral); +freez(&database); return res; } void htmlPrintMafAndFold(FILE *f, struct mafAli *maf, char *fold, double *scores, int lineSize) /* HTML pretty print maf and fold to f. If scores is non-null then * scores are indicated below alignemnt.*/ { struct mafComp *mc; int i, N, lineStart, lineEnd; int *pairList = NULL; int *mafColors = NULL; int **mafColorFormats = NULL; int *scoreColorFormat = NULL; int scoreColors[] = {0x999999,0x888888,0x777777,0x666666,0x555555,0x444444,0x333333,0x222222,0x111111,0x000000};