Fixed 2 bug

Returned correct id when adding a new device.
Fixed crash if no device was found in devHasMethod().
This commit is contained in:
Micke Prag 2008-02-08 13:23:28 +00:00
parent ecf09abe0f
commit be464c4efc

View file

@ -263,7 +263,7 @@ int __stdcall devAddDevice(){
int intNewDeviceId = -1;
try{
TelldusSettings ts;
int intNewDeviceId = ts.addDevice();
intNewDeviceId = ts.addDevice();
}
catch(exception e){
intNewDeviceId = -1;
@ -292,7 +292,9 @@ bool __stdcall devHasMethod(int id, int methodname){
TelldusSettings ts;
char* strModel = ts.getModel(id);
Device* dev = ts.getDevice(id);
blnExists = dev->hasMethod(methodname, strModel);
if (dev != NULL) {
blnExists = dev->hasMethod(methodname, strModel);
}
}
catch(exception e){
blnExists = false;