IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26834


Ignore:
Timestamp:
Feb 9, 2010, 6:24:04 PM (16 years ago)
Author:
Paul Price
Message:

Catch SEGV.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091201/psModules/src/imcombine/pmPSFEnvelope.c

    r26594 r26834  
    6666                     const char *modelName,// Name of PSF model to use
    6767                     int xOrder, int yOrder, // Order for PSF variation fit
    68                      psImageMaskType maskVal
     68                     psImageMaskType maskVal
    6969                     )
    7070{
     
    155155            pmModelClassSetLimits(PM_MODEL_LIMITS_IGNORE);
    156156            pmModel *model = pmModelFromPSFforXY(psf, numCols / 2.0, numRows / 2.0, PEAK_FLUX); // Test model
    157             model->modelSetLimits(PM_MODEL_LIMITS_STRICT);
    158             for (int j = 0; j < model->params->n && goodPSF; j++) {
    159                 if (!model->modelLimits(PS_MINIMIZE_PARAM_MIN, j, model->params->data.F32, NULL) ||
    160                     !model->modelLimits(PS_MINIMIZE_PARAM_MAX, j, model->params->data.F32, NULL)) {
    161                     goodPSF = false;
     157            if (!model) {
     158                goodPSF = false;
     159            } else {
     160                model->modelSetLimits(PM_MODEL_LIMITS_STRICT);
     161                for (int j = 0; j < model->params->n && goodPSF; j++) {
     162                    if (!model->modelLimits(PS_MINIMIZE_PARAM_MIN, j, model->params->data.F32, NULL) ||
     163                        !model->modelLimits(PS_MINIMIZE_PARAM_MAX, j, model->params->data.F32, NULL)) {
     164                        goodPSF = false;
     165                    }
    162166                }
    163             }
    164             psFree(model);
     167                psFree(model);
     168            }
    165169            if (!goodPSF) {
    166170                psWarning("PSF %d is bad --- not including in envelope calculation.", i);
     
    361365
    362366        // measure the source moments: tophat windowing, no pixel S/N cutoff
    363         // XXX probably should be passing the maskVal to this function so we can pass it along here...
     367        // XXX probably should be passing the maskVal to this function so we can pass it along here...
    364368        if (!pmSourceMoments(source, maxRadius, 0.0, 1.0, maskVal)) {
    365369            // Can't do anything about it; limp along as best we can
Note: See TracChangeset for help on using the changeset viewer.