From: SeungWon Lee Date: Thu, 4 Apr 2013 12:45:00 +0000 (+0900) Subject: Fix N_SE-32099 : zero length string may not save to setting.xml X-Git-Tag: accepted/tizen_2.1/20130425.034849~156^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=78a6307ce4de2cc1ee9f9bca621239db5273f212;p=framework%2Fosp%2Fappfw.git Fix N_SE-32099 : zero length string may not save to setting.xml Change-Id: I1fba257362afe98018eec70790a9f83433a44f32 Signed-off-by: SeungWon Lee --- diff --git a/src/app/FApp_AppSettingImpl.cpp b/src/app/FApp_AppSettingImpl.cpp index 4502758..949a767 100644 --- a/src/app/FApp_AppSettingImpl.cpp +++ b/src/app/FApp_AppSettingImpl.cpp @@ -948,10 +948,10 @@ _AppSettingImpl::UpdateProperty(xmlNodePtr pNode, const String& value) { const xmlChar* pPropValue = reinterpret_cast("value"); - std::unique_ptr pBuf(Tizen::Base::Utility::StringUtil::StringToUtf8N(value)); - if (pBuf) + if (value.IsEmpty()) { - xmlAttrPtr attrPtr = xmlSetProp(pNode, pPropValue, reinterpret_cast(pBuf->GetPointer())); + const xmlChar* pZeroLength = reinterpret_cast(""); + xmlAttrPtr attrPtr = xmlSetProp(pNode, pPropValue, pZeroLength); if (attrPtr) { return true; @@ -959,7 +959,19 @@ _AppSettingImpl::UpdateProperty(xmlNodePtr pNode, const String& value) } else { - SysLog(NID_APP, "StringToUtf8N is failed."); + std::unique_ptr pBuf(Tizen::Base::Utility::StringUtil::StringToUtf8N(value)); + if (pBuf) + { + xmlAttrPtr attrPtr = xmlSetProp(pNode, pPropValue, reinterpret_cast(pBuf->GetPointer())); + if (attrPtr) + { + return true; + } + } + else + { + SysLog(NID_APP, "StringToUtf8N is failed."); + } } return false; }