IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38538


Ignore:
Timestamp:
Jun 24, 2015, 2:13:57 PM (11 years ago)
Author:
eugene
Message:

do not crash on missing header pointer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/fits/psFitsImage.c

    r37050 r38538  
    751751
    752752    // Remove any BOFFSET values that exist in the header if we are not using that scaling anymore
    753     if (options&&(!((options->scaling == PS_FITS_SCALE_LOG_RANGE)||
    754                     (options->scaling == PS_FITS_SCALE_LOG_MANUAL)||
    755                     (options->scaling == PS_FITS_SCALE_LOG_STDEV_POSITIVE)||
    756                     (options->scaling == PS_FITS_SCALE_LOG_STDEV_NEGATIVE)||
    757                     (options->scaling == PS_FITS_SCALE_LOG_STDEV_BOTH)||
    758                     (options->scaling == PS_FITS_SCALE_ASINH_RANGE)||
    759                     (options->scaling == PS_FITS_SCALE_ASINH_MANUAL)||
    760                     (options->scaling == PS_FITS_SCALE_ASINH_STDEV_POSITIVE)||
    761                     (options->scaling == PS_FITS_SCALE_ASINH_STDEV_NEGATIVE)||
    762                     (options->scaling == PS_FITS_SCALE_ASINH_STDEV_BOTH)))) {
    763       if (psMetadataLookup(header,"BOFFSET")) {
     753    if (options && (!((options->scaling == PS_FITS_SCALE_LOG_RANGE)||
     754                      (options->scaling == PS_FITS_SCALE_LOG_MANUAL)||
     755                      (options->scaling == PS_FITS_SCALE_LOG_STDEV_POSITIVE)||
     756                      (options->scaling == PS_FITS_SCALE_LOG_STDEV_NEGATIVE)||
     757                      (options->scaling == PS_FITS_SCALE_LOG_STDEV_BOTH)||
     758                      (options->scaling == PS_FITS_SCALE_ASINH_RANGE)||
     759                      (options->scaling == PS_FITS_SCALE_ASINH_MANUAL)||
     760                      (options->scaling == PS_FITS_SCALE_ASINH_STDEV_POSITIVE)||
     761                      (options->scaling == PS_FITS_SCALE_ASINH_STDEV_NEGATIVE)||
     762                      (options->scaling == PS_FITS_SCALE_ASINH_STDEV_BOTH)))) {
     763      if (header && psMetadataLookup(header,"BOFFSET")) {
    764764        psMetadataRemoveKey(header,"BOFFSET");
    765765      }
    766766    }   
    767767    // Remove any BSOFTENvalues that exist in the header if we are not using that scaling anymore
    768     if (options&&(!((options->scaling == PS_FITS_SCALE_ASINH_RANGE)||
    769                     (options->scaling == PS_FITS_SCALE_ASINH_MANUAL)||
    770                     (options->scaling == PS_FITS_SCALE_ASINH_STDEV_POSITIVE)||
    771                     (options->scaling == PS_FITS_SCALE_ASINH_STDEV_NEGATIVE)||
    772                     (options->scaling == PS_FITS_SCALE_ASINH_STDEV_BOTH)))) {
    773       if (psMetadataLookup(header,"BSOFTEN")) {
     768    if (options && (!((options->scaling == PS_FITS_SCALE_ASINH_RANGE)||
     769                      (options->scaling == PS_FITS_SCALE_ASINH_MANUAL)||
     770                      (options->scaling == PS_FITS_SCALE_ASINH_STDEV_POSITIVE)||
     771                      (options->scaling == PS_FITS_SCALE_ASINH_STDEV_NEGATIVE)||
     772                      (options->scaling == PS_FITS_SCALE_ASINH_STDEV_BOTH)))) {
     773      if (header && psMetadataLookup(header,"BSOFTEN")) {
    774774        psMetadataRemoveKey(header,"BSOFTEN");
    775775      }
    776776    }   
    777777
    778     // If there is no options set, remove all our non-standard keywords, because no one asked for them.
     778    // If there are no options set, remove all our non-standard keywords, because no one asked for them.
    779779    if (!options) {
    780       if (psMetadataLookup(header,"BOFFSET")) {
     780      if (header && psMetadataLookup(header,"BOFFSET")) {
    781781        psMetadataRemoveKey(header,"BOFFSET");
    782782      }
    783       if (psMetadataLookup(header,"BSOFTEN")) {
     783      if (header && psMetadataLookup(header,"BSOFTEN")) {
    784784        psMetadataRemoveKey(header,"BSOFTEN");
    785785      }
Note: See TracChangeset for help on using the changeset viewer.