From dc45bf40b887d572cb2c51b64be7eedf93a0aef8 Mon Sep 17 00:00:00 2001 From: yjogol Date: Mon, 19 Sep 2011 17:57:02 +0000 Subject: [PATCH] nhttpd: fix empty parameter. Inspecting parameters added values. git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1703 e54a6e83-5905-42d5-8d5c-058d10e6a962 Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/6689a74a008775cfdad0e3007cc77bfd7e075e4a Author: yjogol Date: 2011-09-19 (Mon, 19 Sep 2011) --- src/nhttpd/yhttpd_core/yhook.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/nhttpd/yhttpd_core/yhook.cpp b/src/nhttpd/yhttpd_core/yhook.cpp index 4b4f7118a..197da9cc1 100644 --- a/src/nhttpd/yhttpd_core/yhook.cpp +++ b/src/nhttpd/yhttpd_core/yhook.cpp @@ -368,10 +368,14 @@ void CyhookHandler::printf(const char *fmt, ...) { TOutType CyhookHandler::checkOutput() { // get outType outType = plain; // plain - if (ParamList["format"] == "json" || !(ParamList["json"].empty()) ) - outType = json; - else if (ParamList["format"] == "xml" || !(ParamList["xml"].empty()) ) - outType = xml; + if(!(ParamList.empty())) { + if ((ParamList.find("format") != ParamList.end() && ParamList["format"] == "json") + || (ParamList.find("json") != ParamList.end() && !(ParamList["json"].empty())) ) + outType = json; + else if ((ParamList.find("format") != ParamList.end() && ParamList["format"] == "xml") + || (ParamList.find("xml") != ParamList.end() && !(ParamList["xml"].empty())) ) + outType = xml; + } return outType; } //-----------------------------------------------------------------------------