You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by di...@apache.org on 2019/01/22 03:23:44 UTC
[rocketmq-client-cpp] branch master updated: Fixed: return a
reference of object which is released in MQMessage::getProperty. (#73)
This is an automated email from the ASF dual-hosted git repository.
dinglei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-cpp.git
The following commit(s) were added to refs/heads/master by this push:
new 1642a3a Fixed: return a reference of object which is released in MQMessage::getProperty. (#73)
1642a3a is described below
commit 1642a3af2e7d235524987ff4990b90beb911a87a
Author: James <yw...@hotmail.com>
AuthorDate: Tue Jan 22 11:23:39 2019 +0800
Fixed: return a reference of object which is released in MQMessage::getProperty. (#73)
---
src/message/MQMessage.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/message/MQMessage.cpp b/src/message/MQMessage.cpp
index 7fb14a7..cc5d16f 100755
--- a/src/message/MQMessage.cpp
+++ b/src/message/MQMessage.cpp
@@ -48,6 +48,9 @@ const string MQMessage::PROPERTY_TRANSACTION_CHECK_TIMES = "TRANSACTION_CHECK_TI
const string MQMessage::PROPERTY_CHECK_IMMUNITY_TIME_IN_SECONDS = "CHECK_IMMUNITY_TIME_IN_SECONDS";
const string MQMessage::KEY_SEPARATOR = " ";
+
+static const string EMPTY_STRING = "";
+
//<!************************************************************************
MQMessage::MQMessage() { Init("", "", "", 0, "", true); }
@@ -109,9 +112,9 @@ void MQMessage::setPropertyInternal(const string& name, const string& value) {
const string & MQMessage::getProperty(const string& name) const {
map<string, string>::const_iterator it = m_properties.find(name);
- if(it == m_properties.end()){
- return "";
- }else{
+ if (it == m_properties.end()) {
+ return EMPTY_STRING;
+ } else {
return it->second;
}
}