fix crash reported by hussam in #transmission

This commit is contained in:
Charles Kerr 2007-11-07 00:42:19 +00:00
parent 6253979516
commit dc6a7b9485
1 changed files with 7 additions and 5 deletions

View File

@ -7,7 +7,7 @@
* This exemption does not extend to derived works not owned by
* the Transmission project.
*
* $Id:$
* $Id$
*/
#include <stdio.h> /* 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 );