Skip to content

Commit

Permalink
PbiStream: check if only a single file is given
Browse files Browse the repository at this point in the history
  • Loading branch information
dbahrdt committed Mar 23, 2018
1 parent 5605b2a commit ec2c2a8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions osmpbf/pbistream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,14 @@ m_priv(std::make_unique<imp::SingleFilePbiStream>(std::move(fileIn)))
{}

PbiStream::PbiStream(std::vector<OSMFileIn> && files) {
if (files.size()) {
if (files.size() > 1) {
m_priv = std::make_unique<imp::MultiFilePbiStream>(files.begin(), files.end());
files.clear();

}
else if (files.size()) {
m_priv = std::make_unique<imp::SingleFilePbiStream>(std::move(files.front()));
}
files.clear();
}

PbiStream::PbiStream(const std::vector<std::string> & fileNames) {
Expand All @@ -229,7 +233,7 @@ PbiStream::PbiStream(const std::vector<std::string> & fileNames) {
}
}
if (files.size() == 1) {
m_priv.reset(new imp::SingleFilePbiStream(std::move(files[0])));
m_priv.reset(new imp::SingleFilePbiStream(std::move(files.front())));
}
else if (files.size() > 1) {
m_priv.reset(new imp::MultiFilePbiStream(files.begin(), files.end()));
Expand Down

0 comments on commit ec2c2a8

Please sign in to comment.