Strictly, I think this should `avps2 = ...`, `if (avps2 != avps.end())`.  It's not necessarily true that all AVP::iterator classes have the same `end()` value.  This may be a recurring bug (possibly even one that I wrote originally) - if it is prevalent and time-consuming to fix, we should maybe just raise a github issue to track it.