}
/**
- * Read device type from the device specific config file
+ * Read device type from the device specific config file.
+ *
+ * @rerurn string representing device type.
+ * In the case of error, an empty string is returned.
*/
string DataReader::get_device_type() {
string ret_val;
if (device_config == NULL) {
device_config = DeviceConfig::get_device_config(device_id);
- ret_val = device_config->get_config_value(DEVICE_CONFIG_VALUE_KEY__TYPE);
+ }
+ if (device_config != NULL) {
+ ret_val = device_config->get_config_value(DEVICE_CONFIG_VALUE_KEY__TYPE);
}
return ret_val;
}