upnp: enforce available mappings limits only if there is a valid IGD.
GitLab: #44
Change-Id: I30ff7177fc9a4a5afbfb6dcd394892792b174e56
diff --git a/src/upnp/upnp_context.cpp b/src/upnp/upnp_context.cpp
index 777f459..cf9b6ed 100644
--- a/src/upnp/upnp_context.cpp
+++ b/src/upnp/upnp_context.cpp
@@ -617,6 +617,10 @@
void
UPnPContext::enforceAvailableMappingsLimits()
{
+ // If there is no valid IGD, do nothing.
+ if (!isReady())
+ return;
+
for (auto type : {PortType::TCP, PortType::UDP}) {
int pendingCount = 0;
int inProgressCount = 0;