If the protocol is not valid, return TELLSTICK_ERROR_CONFIG_SYNTAX instead of TELLSTICK_ERROR_UNKNOWN. Closes #119

This commit is contained in:
Micke Prag 2012-04-13 11:10:27 +02:00
parent 12eb097ce4
commit 8babf9913d

View file

@ -139,7 +139,10 @@ int Device::getType(){
int Device::doAction(int action, unsigned char data, Controller *controller) {
Protocol *p = this->retrieveProtocol();
if(p){
if (!p) {
//Syntax error in configuration, no such protocol
return TELLSTICK_ERROR_CONFIG_SYNTAX;
}
//Try to determine if we need to call another method due to masking
int methods = p->methods();
if ((action & methods) == 0) {
@ -181,8 +184,6 @@ int Device::doAction(int action, unsigned char data, Controller *controller) {
}
return controller->send(code);
}
return TELLSTICK_ERROR_UNKNOWN;
}
Protocol* Device::retrieveProtocol() const {
if (d->protocol) {