From 1b8053a618a84122367699a24f6b2b871f1f2100 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 10 Jan 2014 22:03:01 +0100 Subject: db/upnp/Directory: simplify checkobjok() --- src/db/upnp/Directory.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/db/upnp/Directory.cxx b/src/db/upnp/Directory.cxx index 4a6f20185..bc871a448 100644 --- a/src/db/upnp/Directory.cxx +++ b/src/db/upnp/Directory.cxx @@ -126,21 +126,21 @@ protected: } bool checkobjok() { - bool ok = !m_tobj.m_id.empty() && !m_tobj.m_pid.empty() && - !m_tobj.m_title.empty(); + if (m_tobj.m_id.empty() || m_tobj.m_pid.empty() || + m_tobj.m_title.empty()) + return false; - if (ok && m_tobj.type == UPnPDirObject::Type::ITEM) { + if (m_tobj.type == UPnPDirObject::Type::ITEM) { const char *item_class_name = m_tobj.m_props["upnp:class"].c_str(); auto item_class = ParseItemClass(item_class_name); - if (item_class == UPnPDirObject::ItemClass::UNKNOWN) { - ok = false; - } else { - m_tobj.item_class = item_class; - } + if (item_class == UPnPDirObject::ItemClass::UNKNOWN) + return false; + + m_tobj.item_class = item_class; } - return ok; + return true; } virtual void EndElement(const XML_Char *name) -- cgit v1.2.3