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:
parent
ecf09abe0f
commit
be464c4efc
1 changed files with 4 additions and 2 deletions
|
@ -263,7 +263,7 @@ int __stdcall devAddDevice(){
|
||||||
int intNewDeviceId = -1;
|
int intNewDeviceId = -1;
|
||||||
try{
|
try{
|
||||||
TelldusSettings ts;
|
TelldusSettings ts;
|
||||||
int intNewDeviceId = ts.addDevice();
|
intNewDeviceId = ts.addDevice();
|
||||||
}
|
}
|
||||||
catch(exception e){
|
catch(exception e){
|
||||||
intNewDeviceId = -1;
|
intNewDeviceId = -1;
|
||||||
|
@ -292,7 +292,9 @@ bool __stdcall devHasMethod(int id, int methodname){
|
||||||
TelldusSettings ts;
|
TelldusSettings ts;
|
||||||
char* strModel = ts.getModel(id);
|
char* strModel = ts.getModel(id);
|
||||||
Device* dev = ts.getDevice(id);
|
Device* dev = ts.getDevice(id);
|
||||||
blnExists = dev->hasMethod(methodname, strModel);
|
if (dev != NULL) {
|
||||||
|
blnExists = dev->hasMethod(methodname, strModel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(exception e){
|
catch(exception e){
|
||||||
blnExists = false;
|
blnExists = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue