niedz., 3 lut 2019 o 13:37 Patrick Boettcher <p@xxxxxx> napisał(a): > > As a shared-ptr deleter is called even > if ptr is nullptr > > fixes #35 > > Signed-off-by: Patrick Boettcher <p@xxxxxx> > --- > bindings/cxx/iter.cpp | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/bindings/cxx/iter.cpp b/bindings/cxx/iter.cpp > index 0f11057..16ce0cd 100644 > --- a/bindings/cxx/iter.cpp > +++ b/bindings/cxx/iter.cpp > @@ -58,10 +58,12 @@ bool chip_iter::operator!=(const chip_iter& rhs) const noexcept > } > > chip_iter::chip_iter(::gpiod_chip_iter *iter) > - : _m_iter(iter, chip_iter_deleter), > - _m_current(chip(::gpiod_chip_iter_next_noclose(this->_m_iter.get()))) > + : _m_iter(iter, chip_iter_deleter) > { > + ::gpiod_chip* first = ::gpiod_chip_iter_next_noclose(this->_m_iter.get()); > > + if (first != nullptr) > + this->_m_current = chip(first); > } > > chip_iter& chip_iter::operator++(void) > -- > 2.20.1 > Applied, thanks! Bart