diff options
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/upnp/ContentDirectoryService.cxx | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/db/upnp/ContentDirectoryService.cxx b/src/db/upnp/ContentDirectoryService.cxx index b666716f7..d57f426ec 100644 --- a/src/db/upnp/ContentDirectoryService.cxx +++ b/src/db/upnp/ContentDirectoryService.cxx @@ -27,6 +27,7 @@ #include "Action.hxx" #include "util/Error.hxx" +#include <string.h> #include <stdio.h> ContentDirectoryService::ContentDirectoryService(const UPnPDevice &device, @@ -243,19 +244,22 @@ ContentDirectoryService::getSearchCapabilities(UpnpClient_Handle hdl, return false; } - std::string tbuf = ixmlwrap::getFirstElementValue(response, "SearchCaps"); - ixmlDocument_free(response); + const char *s = ixmlwrap::getFirstElementValue(response, "SearchCaps"); + if (s == nullptr || *s == 0) { + ixmlDocument_free(response); + return true; + } - if (!tbuf.compare("*")) { + bool success = true; + if (strcmp(s, "*") == 0) { result.insert(result.end(), "*"); - } else if (!tbuf.empty()) { - if (!csvToStrings(tbuf.c_str(), result)) { - error.Set(upnp_domain, "Bad response"); - return false; - } + } else if (!csvToStrings(s, result)) { + error.Set(upnp_domain, "Bad response"); + success = false; } - return true; + ixmlDocument_free(response); + return success; } bool |