avoid runtime fail with wrong arguments in upnp::update_map (#2094)

This commit is contained in:
Alden Torres 2017-06-20 15:06:14 -04:00 committed by Arvid Norberg
parent f6ca04638c
commit 18eef80676
1 changed files with 3 additions and 0 deletions

View File

@ -778,6 +778,9 @@ void upnp::update_map(rootdevice& d, int const i)
if (d.upnp_connection) return; if (d.upnp_connection) return;
// this should not happen, but in case it does, don't fail at runtime
if (i >= d.mapping.end_index()) return;
std::shared_ptr<upnp> me(self()); std::shared_ptr<upnp> me(self());
mapping_t& m = d.mapping[i]; mapping_t& m = d.mapping[i];