CC: | "Graham Cobb" <g+debian [...] cobb.uk.net> |
Subject: | [PATCH] Crash when device not responding: Can't call method "getcontent" without a package or object reference |
The following bug in Net-UPnP was reported to the Debian BTS at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=910723
Dear Maintainer,
I recently updated my debian testing system and my DLNA applications now sometimes crash with:
Can't call method "getcontent" without a package or object reference at /usr/share/perl5/Net/UPnP/ControlPoint.pm line 107.
The problem occurs when calling a Net::UPnP::ControlPoint search method.
If *any* of the announcements contains a URL which does not respond to a connection attempt then the crash occurs.
The previous version of libnet-upnp-perl handled this.
This is a relatively common occurence on my network as I am using an SSDP proxy to advertise devices which are on another subnet. It is particularly annoying when the missing device is not the one my application is intending to use.
The patch below (to check if the HTTP post succeeded) works for me.
--- /usr/share/perl5/Net/UPnP/ControlPoint.pm.sav 2018-10-09 22:53:01.330259071 +0100
+++ /usr/share/perl5/Net/UPnP/ControlPoint.pm 2018-10-10 11:01:20.909321292 +0100
@@ -97,6 +97,7 @@
$http_req = Net::UPnP::HTTP->new();
$post_res = $http_req->post($dev_addr, $dev_port, "GET", $dev_path, "", "");
+ next if ! $post_res;
if ($Net::UPnP::DEBUG) {
print $post_res->getstatus() . "\n";