ice: do not crash if no upnpContext is passed
Change-Id: I8ef7ed0336a02692fb3ec0959f2f7f8891c52808
diff --git a/src/ice_transport.cpp b/src/ice_transport.cpp
index 302afb1..d88a406 100644
--- a/src/ice_transport.cpp
+++ b/src/ice_transport.cpp
@@ -405,8 +405,13 @@
compCount_,
initiatorSession_ ? "master" : "slave");
- if (upnpEnabled_)
- upnp_ = std::make_shared<upnp::Controller>(options.upnpContext);
+ if (upnpEnabled_) {
+ if (options.upnpContext) {
+ upnp_ = std::make_shared<upnp::Controller>(options.upnpContext);
+ } else if (logger_) {
+ logger_->error("[ice:{}] UPnP enabled, but no context found", fmt::ptr(this));
+ }
+ }
config_ = factory->getIceCfg(); // config copy
if (isTcp_) {