From 1f4c845decad23299609aa00ee97ba1c61a1f027 Mon Sep 17 00:00:00 2001 From: Mika Laitio Date: Thu, 16 Jun 2011 21:59:03 +0300 Subject: [PATCH] better error handling in case where the device specific config file is missing Signed-off-by: Mika Laitio --- src/DataReader.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/DataReader.cc b/src/DataReader.cc index 0e6ebf3..9731bce 100644 --- a/src/DataReader.cc +++ b/src/DataReader.cc @@ -441,14 +441,19 @@ string DataReader::get_device_id() { } /** - * 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; } -- 2.41.0