Solve the crash in WebSocketTest when the network in disconnected.

This commit is contained in:
zhangbin 2014-03-06 16:49:51 +08:00
parent fec04dd6ae
commit 99b2c5453e
1 changed files with 9 additions and 0 deletions

View File

@ -201,6 +201,11 @@ void WebSocketTestLayer::toExtensionsMainLayer(cocos2d::Ref *sender)
// Menu Callbacks
void WebSocketTestLayer::onMenuSendTextClicked(cocos2d::Ref *sender)
{
if (! _wsiSendText)
{
return;
}
if (_wsiSendText->getReadyState() == network::WebSocket::State::OPEN)
{
_sendTextStatus->setString("Send Text WS is waiting...");
@ -216,6 +221,10 @@ void WebSocketTestLayer::onMenuSendTextClicked(cocos2d::Ref *sender)
void WebSocketTestLayer::onMenuSendBinaryClicked(cocos2d::Ref *sender)
{
if (! _wsiSendBinary) {
return;
}
if (_wsiSendBinary->getReadyState() == network::WebSocket::State::OPEN)
{
_sendBinaryStatus->setString("Send Binary WS is waiting...");