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{
|
try{
|
||||||
char* vendor = getVendor(intDeviceId);
|
char* vendor = getVendor(intDeviceId);
|
||||||
|
if (vendor == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
//each new brand must be added here
|
//each new brand must be added here
|
||||||
if (strcmp(vendor, "Nexa") == 0){
|
if (strcmp(vendor, "Nexa") == 0){
|
||||||
|
|
|
@ -161,7 +161,7 @@ void TelldusSettings::debugLog(int debugint){
|
||||||
|
|
||||||
char *TelldusSettings::getStringSetting(int intDeviceId, const char* name, bool parameter) {
|
char *TelldusSettings::getStringSetting(int intDeviceId, const char* name, bool parameter) {
|
||||||
if (d->cfg == 0) {
|
if (d->cfg == 0) {
|
||||||
return "";
|
return NULL;
|
||||||
}
|
}
|
||||||
cfg_t *cfg_device;
|
cfg_t *cfg_device;
|
||||||
for (int i = 0; i < cfg_size(d->cfg, "device"); ++i) {
|
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 strReturn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TelldusSettings::setStringSetting(int intDeviceId, const char* name, const char *value, bool parameter) {
|
bool TelldusSettings::setStringSetting(int intDeviceId, const char* name, const char *value, bool parameter) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue