Skip to content

Commit

Permalink
Add check for null map
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Pals committed Feb 13, 2020
1 parent 8acff98 commit 28b856e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugins/hdf/io/HdfReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,13 @@ void HdfReader::validateMap()
log()->get(LogLevel::Info) << "**JSON map**" << std::endl;
log()->get(LogLevel::Info) << m_pathDimMap << std::endl;

if(!m_pathDimMap.is_object()) {
if(m_pathDimMap.is_null()) {
throw pdal_error("Required option 'map' was not set");
} else if(!m_pathDimMap.is_object()) {
throw pdal_error("Option 'map' must be a JSON object, not a " +
std::string(m_pathDimMap.type_name()));
}

for(auto& [dimName, datasetName] : m_pathDimMap.items()) {
log()->get(LogLevel::Info) << "Key: " << dimName << ", Value: "
<< datasetName << ", Type: " << datasetName.type_name() << std::endl;
Expand Down

0 comments on commit 28b856e

Please sign in to comment.