Permalink
Browse files

[UPnP] fix clients hanging trying to request a NULL Object

  • Loading branch information...
alcoheca committed Oct 12, 2012
1 parent 9a47f64 commit 7af11806a2a175631940fc0348d8079faa5a8c90
Showing with 5 additions and 2 deletions.
  1. +5 −2 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;
}

0 comments on commit 7af1180

Please sign in to comment.