  2105→                                            try {
  2106→                                                auto loc = index.get(nr.positive_ref());
  2107→                                                if (loc.valid()) geom.push_back({loc.lat(), loc.lon()});
  2108→                                            } catch (...) {}
  2109→                                        }
  2110→                                        if (!geom.empty()) {
  2111→                                            int64_t first_nid = wnodes.front().positive_ref();
  2112→                                            int64_t last_nid = wnodes.back().positive_ref();
  2113→                                            local.way_geoms.push_back({way.id(), std::move(geom), first_nid, last_nid});
  2114→                                        }
  2115→                                    }
  2116→
  2117→                                    // Handle closed ways that are admin boundaries themselves
  2118→                                    // Osmium creates areas from closed ways independently of
  2119→                                    // multipolygon relations, even if the way is a relation member.

                                            try {
                                                auto loc = index.get(nr.positive_ref());
                                                if (loc.valid()) geom.push_back({loc.lat(), loc.lon()});
                                            } catch (...) {}
                                        }
                                        if (!geom.empty()) {
                                            int64_t first_nid = wnodes.front().positive_ref();
                                            int64_t last_nid = wnodes.back().positive_ref();
                                            local.way_geoms.push_back({way.id(), std::move(geom), first_nid, last_nid});
                                        }
                                    }

                                    // Handle closed ways that are admin boundaries themselves
                                    // Osmium creates areas from closed ways independently of
                                    // multipolygon relations, even if the way is a relation member.


  2100→
  2101→                                    // Store way geometry only for admin boundary member ways
  2102→                                    if (!wnodes.empty() && admin_way_ids.count(way.id())) {
  2103→                                        std::vector<std::pair<double,double>> geom;
  2104→                                        for (const auto& nr : wnodes) {

                                    // Store way geometry only for admin boundary member ways
                                    if (!wnodes.empty() && admin_way_ids.count(way.id())) {
                                        std::vector<std::pair<double,double>> geom;
                                        for (const auto& nr : wnodes) {


Edit

                                        for (const auto& nr : wnodes) {
                                            try {
                                                auto loc = index.get(nr.positive_ref());
                                                if (loc.valid()) geom.push_back({loc.lat(), loc.lon()});
                                            } catch (...) {}
                                        }
                                        if (!geom.empty()) {

                                        for (const auto& nr : wnodes) {
                                            auto loc = index.get(nr.positive_ref());
                                            if (loc.valid()) geom.push_back({loc.lat(), loc.lon()});
                                        }
                                        if (!geom.empty()) {