fix for undefined protocol

This commit is contained in:
성낙호 2013-08-02 10:35:45 +09:00
parent f0ab05f9e7
commit c9077961e8
2 changed files with 2 additions and 2 deletions

View File

@ -291,7 +291,7 @@ bool WebSocket::init(const Delegate& delegate,
_wsProtocols = new libwebsocket_protocols[protocolCount+1];
memset(_wsProtocols, 0, sizeof(libwebsocket_protocols)*(protocolCount+1));
if (protocols)
if (protocols && protocols->size() > 0)
{
int i = 0;
for (std::vector<std::string>::const_iterator iter = protocols->begin(); iter != protocols->end(); ++iter, ++i)

View File

@ -246,7 +246,7 @@ JSBool js_cocos2dx_extension_WebSocket_constructor(JSContext *cx, uint32_t argc,
JSB_WebSocketDelegate* delegate = new JSB_WebSocketDelegate();
delegate->setJSDelegate(obj);
if (argc == 2 && !JSVAL_IS_VOID(argv[1]))
if (argc == 2)
{
std::vector<std::string> protocols;