IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25250


Ignore:
Timestamp:
Sep 2, 2009, 11:42:45 AM (17 years ago)
Author:
Paul Price
Message:

If first component has no detections, can get empty tree, resulting in abort.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pap_mops/ppMops/src/ppMopsMerge.c

    r25249 r25250  
    3434    psTrace("ppMops.merge", 1, "Merging detections from %ld inputs\n", detections->n);
    3535
    36     ppMopsDetections *merged = psMemIncrRefCounter(detections->data[0]); // Merged list
    37     psTrace("ppMops.merge", 3, "Automatically merging %ld detections from input 0\n", merged->num);
     36    ppMopsDetections *merged = NULL;    // Merged list
    3837    int num = 1;                                                         // Number of merged files
    39     for (int i = 1; i < detections->n; i++) {
     38    for (int i = 0; i < detections->n; i++) {
    4039        ppMopsDetections *det = detections->data[i]; // Detections of interest
    4140        if (!det) {
    4241            psTrace("ppMops.merge", 3, "Ignoring NULL input %d\n", i);
    4342            continue;
     43        } else if (det->num == 0) {
     44            psTrace("ppMops.merge", 3, "Ignoring empty input %d\n", i);
     45            continue;
    4446        }
    4547        num++;
     48        if (!merged) {
     49            psTrace("ppMops.merge", 3, "Accepting %ld detections from input %d\n", det->num, i);
     50            merged = psMemIncrRefCounter(detections->data[0]);
     51            continue;
     52        }
    4653        psTrace("ppMops.merge", 3, "Merging %ld detections from input %d\n", det->num, i);
    4754
Note: See TracChangeset for help on using the changeset viewer.