From dc6a7b9485f8096436697c5aa3e2323e19e72a7e Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 7 Nov 2007 00:42:19 +0000 Subject: [PATCH] fix crash reported by hussam in #transmission --- libtransmission/upnp.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libtransmission/upnp.c b/libtransmission/upnp.c index a8ab0692f..7b624841c 100644 --- a/libtransmission/upnp.c +++ b/libtransmission/upnp.c @@ -7,7 +7,7 @@ * This exemption does not extend to derived works not owned by * the Transmission project. * - * $Id:$ + * $Id$ */ #include /* printf */ @@ -70,10 +70,12 @@ tr_upnpStart( tr_upnp * handle ) { char portStr[16]; snprintf( portStr, sizeof(portStr), "%d", handle->port ); - handle->isForwarding = UPNP_AddPortMapping( handle->urls.controlURL, - handle->data.servicetype, - portStr, portStr, handle->lanaddr, - "Transmission", "TCP" ); + handle->isForwarding = ( handle->urls.controlURL != NULL ) && + ( handle->data.servicetype != NULL ) && + ( UPNP_AddPortMapping( handle->urls.controlURL, + handle->data.servicetype, + portStr, portStr, handle->lanaddr, + "Transmission", "TCP" ) ); tr_dbg( "UPNP Port Forwarding via '%s', service '%s'. (local address: %s:%d)", handle->urls.controlURL, handle->data.servicetype, handle->lanaddr, handle->port );