IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 25, 2011, 12:32:27 PM (15 years ago)
Author:
rhenders
Message:

cleaned-up file closing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/src/Fits.c

    r31036 r31930  
    3838    this->logger->print(this->logger, MSG_DEBUG, "Fits", "Destructor\n");
    3939
    40     int status = 0;
    41     if (fits_close_file(this->file, &status)) {
    42 
    43         this->logger->print(this->logger, MSG_ERROR, "Fits", "Unable to close FITS file '%s'\n", this->path);
    44         fits_report_error(stderr, status);
    45     }
    46     else
    47         this->logger->print(this->logger, MSG_DEBUG, "Fits", "Closed FITS file '%s'\n", this->path);
     40    // if there is a file to close, then close it
     41    if (this->file != NULL) {
     42
     43        int status = 0;
     44
     45        if (fits_close_file(this->file, &status)) {
     46
     47            this->logger->print(this->logger, MSG_ERROR, "Fits", "Unable to close FITS file '%s'\n", this->path);
     48            fits_report_error(stderr, status);
     49        }
     50        else
     51            this->logger->print(this->logger, MSG_INFO, "Fits", "Closed FITS file '%s'\n", this->path);
     52    }
    4853
    4954    free(this);
Note: See TracChangeset for help on using the changeset viewer.