Commit 7f9eeb16 authored by Paal Kvamme's avatar Paal Kvamme
Browse files

Fix histogram for version 1 files.

parent 5cdd5d1d
......@@ -313,9 +313,12 @@ public:
histogram() const override
{
const InternalZGY::IHistHeaderAccess& hh = _meta->hh();
return SampleHistogram(hh.samplecount(), hh.minvalue(), hh.maxvalue(),
std::vector<std::int64_t>(hh.bins(),
hh.bins() + hh.bincount()));
if (hh.bincount() > 0 && hh.bins() != nullptr)
return SampleHistogram(hh.samplecount(), hh.minvalue(), hh.maxvalue(),
std::vector<std::int64_t>(hh.bins(),
hh.bins() + hh.bincount()));
else
return SampleHistogram();
}
std::shared_ptr<const FileStatistics> filestats_nocache() const
......
......@@ -1768,6 +1768,7 @@ ZgyInternalMeta::initFromOpenFile(const std::shared_ptr<FileADT>& file_in)
this->_hh = HeaderAccessFactory::createHistHeader(version);
this->_hh->read(file, _oh->histoff(), _oh->histsize());
this->_hh->calculate();
// For V2 and later, fill in the missing strings in InfoHeader
// now that the StringList is known.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment