From eea09d60f76c9e434984638e7beaab0c73d9fd0f Mon Sep 17 00:00:00 2001 From: boyu0 Date: Mon, 18 Nov 2013 14:33:24 +0800 Subject: [PATCH] fix keypad test crash bug --- cocos/2d/CCEventListenerKeyboard.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cocos/2d/CCEventListenerKeyboard.cpp b/cocos/2d/CCEventListenerKeyboard.cpp index c947a43e36..77ce94d705 100644 --- a/cocos/2d/CCEventListenerKeyboard.cpp +++ b/cocos/2d/CCEventListenerKeyboard.cpp @@ -31,7 +31,11 @@ NS_CC_BEGIN bool EventListenerKeyboard::checkAvailable() { - CCASSERT(onKeyPressed && onKeyReleased, ""); + if (onKeyPressed == nullptr && onKeyReleased == nullptr) + { + CCASSERT(false, "Invalid EventListenerKeyboard!"); + return false; + } return true; }