@@ -214,10 +214,6 @@ slim_middle_t &osmdata_t::slim_middle() const noexcept
214214void osmdata_t::node (osmium::Node const &node)
215215{
216216 if (node.deleted ()) {
217- if (!m_append) {
218- throw std::runtime_error{" Input file contains deleted objects but "
219- " you are not in append mode." };
220- }
221217 node_delete (node.id ());
222218 } else {
223219 // if the node is not valid, then node.location.lat/lon() can throw.
@@ -248,10 +244,6 @@ void osmdata_t::way(osmium::Way &way)
248244 }
249245
250246 if (way.deleted ()) {
251- if (!m_append) {
252- throw std::runtime_error{" Input file contains deleted objects but "
253- " you are not in append mode." };
254- }
255247 way_delete (way.id ());
256248 } else {
257249 if (m_append) {
@@ -271,10 +263,6 @@ void osmdata_t::relation(osmium::Relation const &rel)
271263 }
272264
273265 if (rel.deleted ()) {
274- if (!m_append) {
275- throw std::runtime_error{" Input file contains deleted objects but "
276- " you are not in append mode." };
277- }
278266 relation_delete (rel.id ());
279267 } else {
280268 if (rel.members ().size () > 32767 ) {
@@ -606,6 +594,11 @@ progress_display_t osmdata_t::process_file(osmium::io::File const &file)
606594 while (osmium::memory::Buffer buffer = reader.read ()) {
607595 for (auto &object : buffer.select <osmium::OSMObject>()) {
608596 last = check_input (last, object);
597+ if (!m_append && object.deleted ()) {
598+ throw std::runtime_error{
599+ " Input file contains deleted objects but "
600+ " you are not in append mode." };
601+ }
609602 osmium::apply_item (object, *this );
610603 }
611604 }
@@ -640,6 +633,11 @@ osmdata_t::process_files(std::vector<osmium::io::File> const &files)
640633 auto element = queue.top ();
641634 queue.pop ();
642635 if (queue.empty () || element != queue.top ()) {
636+ if (!m_append && element.object ().deleted ()) {
637+ throw std::runtime_error{
638+ " Input file contains deleted objects but "
639+ " you are not in append mode." };
640+ }
643641 osmium::apply_item (element.object (), *this );
644642 }
645643
0 commit comments