aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlasdair Campbell <alcoheca@gmail.com>2012-10-12 22:29:25 +0100
committerAlasdair Campbell <alcoheca@gmail.com>2012-10-12 22:38:07 +0100
commit7af11806a2a175631940fc0348d8079faa5a8c90 (patch)
tree38a4781804dfa9842e0ae8d918c5b18c1b05abc3
parent9a47f640275a219f41a2568a559b69289df5ca56 (diff)
[UPnP] fix clients hanging trying to request a NULL Object
-rw-r--r--xbmc/network/upnp/UPnPServer.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/xbmc/network/upnp/UPnPServer.cpp b/xbmc/network/upnp/UPnPServer.cpp
index 806af5b9fb..f1cd7a9970 100644
--- a/xbmc/network/upnp/UPnPServer.cpp
+++ b/xbmc/network/upnp/UPnPServer.cpp
@@ -632,11 +632,14 @@ CUPnPServer::BuildResponse(PLT_ActionReference& action,
NPT_UInt32 stop_index = min((unsigned long)(starting_index + max_count), (unsigned long)items.Size()); // don't return more than we can
NPT_Cardinal count = 0;
+ NPT_Cardinal total = items.Size();
NPT_String didl = didl_header;
PLT_MediaObjectReference object;
for (unsigned long i=starting_index; i<stop_index; ++i) {
object = Build(items[i], true, context, thumb_loader, parent_id);
if (object.IsNull()) {
+ // don't tell the client this item ever existed
+ --total;
continue;
}
@@ -655,11 +658,11 @@ CUPnPServer::BuildResponse(PLT_ActionReference& action,
CLog::Log(LOGDEBUG, "Returning UPnP response with %d items out of %d total matches",
count,
- items.Size());
+ total);
NPT_CHECK(action->SetArgumentValue("Result", didl));
NPT_CHECK(action->SetArgumentValue("NumberReturned", NPT_String::FromInteger(count)));
- NPT_CHECK(action->SetArgumentValue("TotalMatches", NPT_String::FromInteger(items.Size())));
+ NPT_CHECK(action->SetArgumentValue("TotalMatches", NPT_String::FromInteger(total)));
NPT_CHECK(action->SetArgumentValue("UpdateId", "0"));
return NPT_SUCCESS;
}