Fixed segfault if the device is not found
This commit is contained in:
parent
d2f81b089d
commit
05013a9074
2 changed files with 5 additions and 2 deletions
|
@ -16,6 +16,9 @@ Device* TelldusSettings::getDevice(int intDeviceId){
|
|||
|
||||
try{
|
||||
char* vendor = getVendor(intDeviceId);
|
||||
if (vendor == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//each new brand must be added here
|
||||
if (strcmp(vendor, "Nexa") == 0){
|
||||
|
|
|
@ -161,7 +161,7 @@ void TelldusSettings::debugLog(int debugint){
|
|||
|
||||
char *TelldusSettings::getStringSetting(int intDeviceId, const char* name, bool parameter) {
|
||||
if (d->cfg == 0) {
|
||||
return "";
|
||||
return NULL;
|
||||
}
|
||||
cfg_t *cfg_device;
|
||||
for (int i = 0; i < cfg_size(d->cfg, "device"); ++i) {
|
||||
|
@ -179,7 +179,7 @@ char *TelldusSettings::getStringSetting(int intDeviceId, const char* name, bool
|
|||
return strReturn;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool TelldusSettings::setStringSetting(int intDeviceId, const char* name, const char *value, bool parameter) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue