Changeset 3020


Ignore:
Timestamp:
12/15/14 17:26:43 (10 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-7193

Ready for Test: Yes

Interface Changes: Yes/No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Fix for segmentation fault when invalid Tsys table is applied.


Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/Locator.tcc

    r2732 r3020  
    1111//
    1212#include <assert.h>
     13#include <iostream>
     14#include <stdexcept>
    1315
    1416#include "Locator.h"
     
    5759    x_ = v;
    5860  }
     61  assert(n_ > 0);
     62  if (n_ == 0) {
     63    throw std::runtime_error("Input array length is 0.");
     64  }
    5965  ascending_ = (x_[0] <= x_[n_-1]);
    6066}
  • trunk/src/STApplyCal.cpp

    r2965 r3020  
    507507                                     timeTsys, tsys, flagtsys);
    508508    nrowTsys = timeTsys.nelements();
     509
     510    if (allNE(flagtsys, (uChar)0)) {
     511      os_ << LogIO::WARN << "No valid Tsys measurement. Skip Tsys calibration." << LogIO::POST;
     512      doTsys = False;
     513    }
    509514  }
    510515
     
    574579        uInt wnchan = setupWorkingData(nchanTsys, ftsys.data(), iTsysT.data(),
    575580                                       fwork_p, xwork_p, ywork_p);
     581        assert(wnchan > 0);
     582        if (wnchan == 0) {
     583          throw AipsError("No valid Tsys measurements.");
     584        }
    576585        interpolatorF_->setData(xwork_p, ywork_p, wnchan);
    577         for (uInt ichan = 0; ichan < nchanSp; ichan++) {
     586        for (uInt ichan = 0; ichan < nchanSp; ichan++) {
    578587          iTsys[ichan] = interpolatorF_->interpolate(fsp[ichan]);
    579588        }
Note: See TracChangeset for help on using the changeset viewer.