IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 3, 2010, 5:11:47 PM (16 years ago)
Author:
Paul Price
Message:

Add error checking.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSourceIO_CMF_PS1_V2.c

    r26964 r27177  
    216216
    217217    if (table->n == 0) {
    218         psFitsWriteBlank(fits, header, extname);
     218        if (!psFitsWriteBlank(fits, header, extname)) {
     219            psError(psErrorCodeLast(), false, "Unable to write blank sources file.");
     220            psFree(table);
     221            psFree(header);
     222            return false;
     223        }
    219224        psFree(table);
    220225        psFree(header);
     
    224229    psTrace ("pmFPAfile", 5, "writing ext data %s\n", extname);
    225230    if (!psFitsWriteTable(fits, header, table, extname)) {
    226         psError(PS_ERR_IO, false, "writing ext data %s\n", extname);
     231        psError(psErrorCodeLast(), false, "writing ext data %s\n", extname);
    227232        psFree(table);
    228233        psFree(header);
     
    264269    for (int i = 0; i < numSources; i++) {
    265270        psMetadata *row = psFitsReadTableRow(fits, i); // Table row
     271        if (!row) {
     272            psError(psErrorCodeLast(), false, "Unable to read row %d of sources", i);
     273            psFree(sources);
     274            return NULL;
     275        }
    266276
    267277        pmSource *source = pmSourceAlloc ();
     
    487497
    488498    if (table->n == 0) {
    489         psFitsWriteBlank (fits, outhead, extname);
     499        if (!psFitsWriteBlank (fits, outhead, extname)) {
     500            psError(psErrorCodeLast(), false, "Unable to write empty sources file.");
     501            psFree(outhead);
     502            psFree(table);
     503            return false;
     504        }
    490505        psFree (outhead);
    491506        psFree (table);
     
    495510    psTrace ("pmFPAfile", 5, "writing ext data %s\n", extname);
    496511    if (!psFitsWriteTable (fits, outhead, table, extname)) {
    497         psError(PS_ERR_IO, false, "writing ext data %s\n", extname);
     512        psError(psErrorCodeLast(), false, "writing ext data %s\n", extname);
    498513        psFree (outhead);
    499514        psFree(table);
     
    613628
    614629    if (table->n == 0) {
    615         psFitsWriteBlank (fits, outhead, extname);
     630        if (!psFitsWriteBlank (fits, outhead, extname)) {
     631            psError(psErrorCodeLast(), false, "Unable to write empty sources file.");
     632            psFree(outhead);
     633            psFree(table);
     634            return false;
     635        }
    616636        psFree (outhead);
    617637        psFree (table);
     
    621641    psTrace ("pmFPAfile", 5, "writing ext data %s\n", extname);
    622642    if (!psFitsWriteTable (fits, outhead, table, extname)) {
    623         psError(PS_ERR_IO, false, "writing ext data %s\n", extname);
     643        psError(psErrorCodeLast(), false, "writing ext data %s\n", extname);
    624644        psFree (outhead);
    625645        psFree(table);
Note: See TracChangeset for help on using the changeset viewer.