File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -70,13 +70,13 @@ class geometry_n_visitor
7070
7171 void operator ()(geom::collection_t const &input) const
7272 {
73- *m_output = input[m_n - 1 ];
73+ *m_output = input[m_n];
7474 }
7575
7676 template <typename T>
7777 void operator ()(geom::multigeometry_t <T> const &input) const
7878 {
79- m_output->set <T>() = input[m_n - 1 ];
79+ m_output->set <T>() = input[m_n];
8080 }
8181
8282 template <typename T>
@@ -95,13 +95,13 @@ class geometry_n_visitor
9595
9696void geometry_n (geometry_t *output, geometry_t const &input, std::size_t n)
9797{
98- auto const num = num_geometries (input);
99- if (n < 1 || n > num ) {
98+ auto const max = num_geometries (input);
99+ if (n < 1 || n > max ) {
100100 output->reset ();
101101 return ;
102102 }
103103
104- input.visit (geometry_n_visitor{output, n});
104+ input.visit (geometry_n_visitor{output, n - 1 });
105105 output->set_srid (input.srid ());
106106}
107107
You can’t perform that action at this time.
0 commit comments