Browse Source

Fixed a bug with a crash if the link with the data cannot be opened

lintest
Michael Uleysky 1 year ago
parent
commit
2eb57ac715
  1. 11
      include/layereddata.h
  2. 3
      src/layereddata.cpp

11
include/layereddata.h

@ -49,14 +49,15 @@ class LayeredData: public NCFuncs
}
const NCFileA* operator->() const { return &nc; }
explicit operator bool() const { return nc; }
MDateTime Begin() const { return times.front(); }
MDateTime End() const { return times.back(); }
explicit operator bool() const { return nc; }
MDateTime Begin() const { return times.front(); }
MDateTime End() const { return times.back(); }
const NCFileA& Get() const { return nc; }
const std::vector<MDateTime>& Times() const { return times; }
size_t Index(MDateTime tm) const
size_t Index(MDateTime tm) const
{
if(tm < Begin() || tm > End()) return 0;
size_t b = 0, e = times.size() - 1;
@ -73,6 +74,8 @@ class LayeredData: public NCFuncs
}
return 0;
}
const MString& Url() const { return url; }
};
std::vector<NC> nc;
std::vector<real> depths;

3
src/layereddata.cpp

@ -51,8 +51,9 @@ MString LayeredData::Open(const MString& dataset)
nc.emplace_back(std::move(url));
if(!nc.back())
{
auto failedurl = nc.back().Url();
nc.clear();
return "Can't connect to url " + url;
return "Can't connect to url " + failedurl;
}
}
else

Loading…
Cancel
Save