添加 assert(Port, "Port为空,不能发送数据") 提示

This commit is contained in:
cdyong 2016-07-16 04:00:14 +00:00
parent 084903a9e6
commit 49181738f1
1 changed files with 22 additions and 21 deletions

View File

@ -154,7 +154,6 @@ bool Controller::Reply(Message& msg)
bool Controller::SendInternal(const Message& msg) bool Controller::SendInternal(const Message& msg)
{ {
TS("Controller::SendInternal"); TS("Controller::SendInternal");
// 如果没有传输口处于打开状态,则发送失败 // 如果没有传输口处于打开状态,则发送失败
if (!Port->Open()) return false; if (!Port->Open()) return false;
@ -169,6 +168,8 @@ bool Controller::SendInternal(const Message& msg)
bool Controller::SendInternal(const Buffer& bs, const void* state) bool Controller::SendInternal(const Buffer& bs, const void* state)
{ {
assert(Port, "Port为空,不能发送数据");
if (state == nullptr) if (state == nullptr)
return Port->Write(bs); return Port->Write(bs);
else else