Fixed segfault if the device is not found

This commit is contained in:
Micke Prag 2008-10-16 13:16:44 +00:00
parent d2f81b089d
commit 05013a9074
2 changed files with 5 additions and 2 deletions

View file

@ -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){

View file

@ -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) {