IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18241


Ignore:
Timestamp:
Jun 20, 2008, 10:09:33 AM (18 years ago)
Author:
Paul Price
Message:

Trap case where !peaks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotSourceStats.c

    r17396 r18241  
    3030
    3131    psArray *peaks = detections->peaks;
     32    if (!peaks) {
     33        psError(PS_ERR_UNEXPECTED_NULL, false, "No peaks found!");
     34        return NULL;
     35    }
    3236
    3337    sources = psArrayAllocEmpty (peaks->n);
     
    3741    for (int i = 0; i < peaks->n; i++) {
    3842
    39         pmPeak *peak = peaks->data[i];
    40         if (peak->assigned) continue;
     43        pmPeak *peak = peaks->data[i];
     44        if (peak->assigned) continue;
    4145
    4246        // create a new source, add peak
     
    4751        pmSourceDefinePixels (source, readout, source->peak->x, source->peak->y, OUTER);
    4852        if (!strcasecmp (breakPt, "PEAKS")) {
    49             peak->assigned = true;
     53            peak->assigned = true;
    5054            psArrayAdd (sources, 100, source);
    5155            psFree (source);
     
    5559        // skip faint sources for moments measurement
    5660        if (source->peak->SN < MIN_SN) {
    57             peak->assigned = true;
     61            peak->assigned = true;
    5862            psArrayAdd (sources, 100, source);
    5963            psFree (source);
     
    6266
    6367        // measure a local sky value
    64         // the local sky is now ignored; kept here for reference only
     68        // the local sky is now ignored; kept here for reference only
    6569        status = pmSourceLocalSky (source, PS_STAT_SAMPLE_MEDIAN, INNER, maskVal, mark);
    6670        if (!status) {
     
    8589        if (status) {
    8690            // add to the source array
    87             peak->assigned = true;
     91            peak->assigned = true;
    8892            psArrayAdd (sources, 100, source);
    8993            psFree (source);
     
    99103        if (status) {
    100104            // add to the source array
    101             peak->assigned = true;
     105            peak->assigned = true;
    102106            psArrayAdd (sources, 100, source);
    103107            psFree (source);
Note: See TracChangeset for help on using the changeset viewer.