IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15396


Ignore:
Timestamp:
Oct 26, 2007, 1:15:06 PM (19 years ago)
Author:
Paul Price
Message:

Protecting from some of the input pmStackData being NULL.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/imcombine/pmStack.c

    r14648 r15396  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2007-08-23 23:43:12 $
     10 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2007-10-26 23:15:06 $
    1212 *
    1313 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
     
    221221    for (int i = 0; i < num; i++) {
    222222        pmStackData *data = inputs->data[i]; // Stack data of interest
     223        if (!data) {
     224            continue;
     225        }
    223226        psImage *image = data->readout->image; // Image of interest
    224227        psImage *weight = data->readout->weight; // Weight map of interest
     
    292295                // Add the pixel as one to inspect
    293296                pmStackData *data = inputs->data[j]; // Stack data of interest
     297                if (!data) {
     298                    continue;
     299                }
    294300                data->pixels = psPixelsAdd(data->pixels, PIXEL_LIST_BUFFER, x, y);
    295301                // Mask it so it's not considered in other iterations within this function
     
    315321    *num = input->n;
    316322
    317     // The first is a template
    318     pmStackData *data = input->data[0]; // First image off the rank
     323    pmStackData *data = NULL;           // First image off the rank, used as a template
     324    for (int i = 0; !data && i < input->n; i++) {
     325        data = input->data[i];
     326    }
    319327    PS_ASSERT_PTR_NON_NULL(data, false);
    320328    assert(psMemGetDeallocator(data) == (psFreeFunc)stackDataFree); // Ensure it's the right type
     
    338346    for (int i = 1; i < *num; i++) {
    339347        pmStackData *data = input->data[i]; // Stack data for this input
     348        if (!data) {
     349            continue;
     350        }
    340351        assert(psMemGetDeallocator(data) == (psFreeFunc)stackDataFree); // Ensure it's the right type
    341352        if (!data->readout) {
     
    469480    for (int i = 0; i < input->n; i++) {
    470481        pmStackData *data = input->data[i];
    471         assert(data && data->pixels);
     482        if (!data) {
     483            continue;
     484        }
     485        assert(data->pixels);
    472486        psPixels *pixels = data->pixels;// The pixels of interest
    473487        for (int j = 0; j < pixels->n; j++) {
     
    544558    for (int i = 0; i < num; i++) {
    545559        pmStackData *data = input->data[i]; // Stack data for this input
     560        if (!data) {
     561            weights->data.F32[i] = 0.0;
     562        }
    546563        weights->data.F32[i] = data->weight;
    547564    }
     
    561578        for (int i = 0; i < num; i++) {
    562579            pmStackData *data = input->data[i]; // Stacking data; contains the list of pixels
     580            if (!data) {
     581                continue;
     582            }
    563583            pixels = psPixelsConcatenate(pixels, data->pixels);
    564584            data->pixels = psPixelsRealloc(data->pixels, PIXEL_LIST_BUFFER); // Just in case more rejection
     
    596616            for (int i = 0; i < num; i++) {
    597617                pmStackData *data = input->data[i]; // Stack data for this input
     618                if (!data) {
     619                    continue;
     620                }
    598621                data->pixels = psPixelsAllocEmpty(PIXEL_LIST_BUFFER);
    599622            }
     
    611634            for (int i = 0; i < num; i++) {
    612635                pmStackData *data = input->data[i]; // Stack data for this input
     636                if (!data) {
     637                    continue;
     638                }
    613639                psTrace("psModules.imcombine", 5, "Image %d: %ld pixels to inspect.\n", i, data->pixels->n);
    614640            }
Note: See TracChangeset for help on using the changeset viewer.