2155:                                                            } catch (...) { all_valid = false; break; }


  2148→                                                        bool all_valid = true;
  2149→                                                        for (const auto& nr : wnodes) {
  2150→                                                            try {
  2151→                                                                auto loc = index.get(nr.positive_ref());
  2152→                                                                if (loc.valid()) {
  2153→                                                                    verts.push_back({loc.lat(), loc.lon()});
  2154→                                                                } else { all_valid = false; break; }
  2155→                                                            } catch (...) { all_valid = false; break; }
  2156→                                                        }
  2157→                                                        if (all_valid && verts.size() >= 3) {
  2158→                                                            std::string cc;
  2159→                                                            if (al == 2) {
  2160→                                                                const char* iso = way.tags()["ISO3166-1:alpha2"];
  2161→                                                                if (iso) cc = iso;
  2162→                                                            }

                                                        bool all_valid = true;
                                                        for (const auto& nr : wnodes) {
                                                            try {
                                                                auto loc = index.get(nr.positive_ref());
                                                                if (loc.valid()) {
                                                                    verts.push_back({loc.lat(), loc.lon()});
                                                                } else { all_valid = false; break; }
                                                            } catch (...) { all_valid = false; break; }
                                                        }
                                                        if (all_valid && verts.size() >= 3) {
                                                            std::string cc;
                                                            if (al == 2) {
                                                                const char* iso = way.tags()["ISO3166-1:alpha2"];
                                                                if (iso) cc = iso;
                                                            }


Edit

                                                        for (const auto& nr : wnodes) {
                                                            try {
                                                                auto loc = index.get(nr.positive_ref());
                                                                if (loc.valid()) {
                                                                    verts.push_back({loc.lat(), loc.lon()});
                                                                } else { all_valid = false; break; }
                                                            } catch (...) { all_valid = false; break; }
                                                        }

                                                        for (const auto& nr : wnodes) {
                                                            auto loc = index.get(nr.positive_ref());
                                                            if (loc.valid()) {
                                                                verts.push_back({loc.lat(), loc.lon()});
                                                            } else { all_valid = false; break; }
                                                        }