IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26936


Ignore:
Timestamp:
Feb 12, 2010, 4:44:06 PM (16 years ago)
Author:
Paul Price
Message:

Fix SEGV when no sources provided.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSub/src/ppSubMatchPSFs.c

    r26899 r26936  
    123123    pmReadout *inSourceRO = pmFPAfileThisReadout(config->files, view, "PPSUB.INPUT.SOURCES");
    124124    pmReadout *refSourceRO = pmFPAfileThisReadout(config->files, view, "PPSUB.REF.SOURCES");
    125     // XXX assert on inSourcesRO and refSourcesRO?
     125    if (!inSourceRO || !refSourceRO) {
     126        psWarning("Unable to scale kernel, since no sources were provided.");
     127        return true;
     128    }
    126129
    127130    pmDetections *inDetections = psMetadataLookupPtr(NULL, inSourceRO->analysis, "PSPHOT.DETECTIONS"); // Input sources
     
    214217    pmDetections *detections = NULL;    // Merged detection set
    215218    if (inDetections && refDetections) {
    216         psArray *inSources  = inDetections->allSources;
    217         psArray *refSources = refDetections->allSources;
    218 
    219         psAssert (inSources, "missing in sources?");
    220         psAssert (refSources, "missing ref sources?");
    221 
    222         detections = pmDetectionsAlloc();
     219        psArray *inSources  = inDetections->allSources;
     220        psArray *refSources = refDetections->allSources;
     221
     222        psAssert (inSources, "missing in sources?");
     223        psAssert (refSources, "missing ref sources?");
     224
     225        detections = pmDetectionsAlloc();
    223226        float radius = psMetadataLookupF32(NULL, recipe, "SOURCE.RADIUS"); // Matching radius
    224227        psArray *lists = psArrayAlloc(2); // Source lists
     
    229232        if (!detections->allSources) {
    230233            psError(PS_ERR_UNKNOWN, false, "Unable to merge source lists");
    231             psFree(detections);
     234            psFree(detections);
    232235            return false;
    233236        }
    234     } 
     237    }
    235238    if (!detections && inDetections) {
    236239        detections = psMemIncrRefCounter(inDetections);
    237     } 
     240    }
    238241    if (!detections && refDetections) {
    239242        detections = psMemIncrRefCounter(refDetections);
Note: See TracChangeset for help on using the changeset viewer.