Browse Source

Pass actual size of string in message callback

Paul-Louis Ageneau 5 years ago
parent
commit
e02c30027b
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/rtc.cpp

+ 1 - 1
src/rtc.cpp

@@ -487,7 +487,7 @@ int rtcSetMessageCallback(int id, rtcMessageCallbackFunc cb) {
 			    },
 			    },
 			    [id, cb](const string &s) {
 			    [id, cb](const string &s) {
 				    if (auto ptr = getUserPointer(id))
 				    if (auto ptr = getUserPointer(id))
-					    cb(s.c_str(), -1, *ptr);
+					    cb(s.c_str(), -(s.size() + 1), *ptr);
 			    });
 			    });
 		else
 		else
 			channel->onMessage(nullptr);
 			channel->onMessage(nullptr);