Skip to content
Snippets Groups Projects
Verified Commit a8458e79 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

check for nullptr in configuration.cpp

parent daf7ce59
Branches
Tags
2 merge requests!42Release 0.2.0,!39F remove boost rdep
...@@ -468,7 +468,7 @@ auto ConfigurationManager::InitializeDefaults() -> int { // NOLINT ...@@ -468,7 +468,7 @@ auto ConfigurationManager::InitializeDefaults() -> int { // NOLINT
} }
// Logging in the configuration leads to additional content. // Logging in the configuration leads to additional content.
if (WRAPPED_JSON_CONFIGURATION(this)->is_object() && if (!this->json_configuration.IsNull() && WRAPPED_JSON_CONFIGURATION(this)->is_object() &&
WRAPPED_JSON_CONFIGURATION(this)->as_object().contains("logging")) { WRAPPED_JSON_CONFIGURATION(this)->as_object().contains("logging")) {
LoggingConfiguration logging_configuration = LoggingConfiguration logging_configuration =
CreateLoggingConfiguration(WRAPPED_JSON_CONFIGURATION(this)->at("logging").as_object()); CreateLoggingConfiguration(WRAPPED_JSON_CONFIGURATION(this)->at("logging").as_object());
...@@ -479,7 +479,7 @@ auto ConfigurationManager::InitializeDefaults() -> int { // NOLINT ...@@ -479,7 +479,7 @@ auto ConfigurationManager::InitializeDefaults() -> int { // NOLINT
"We are using the default configuration"; "We are using the default configuration";
} }
if (configuration_file_path != nullptr && WRAPPED_JSON_CONFIGURATION(this)->is_object()) { if (configuration_file_path != nullptr && !this->json_configuration.IsNull() && WRAPPED_JSON_CONFIGURATION(this)->is_object() {
CAOSDB_LOG_INFO(logger_name) << "Loaded configuration from " << *(configuration_file_path) CAOSDB_LOG_INFO(logger_name) << "Loaded configuration from " << *(configuration_file_path)
<< "."; << ".";
} }
......
...@@ -147,7 +147,7 @@ auto load_json_file(const path &json_file) -> JsonValue { ...@@ -147,7 +147,7 @@ auto load_json_file(const path &json_file) -> JsonValue {
JsonValue::~JsonValue() { this->Reset(); } JsonValue::~JsonValue() { this->Reset(); }
auto JsonValue::Reset() -> void { auto JsonValue::Reset() -> void {
void * tmp = std::move(this->wrapped); void *tmp = std::move(this->wrapped);
this->wrapped = nullptr; this->wrapped = nullptr;
if (tmp != nullptr) { if (tmp != nullptr) {
delete static_cast<value *>(tmp); delete static_cast<value *>(tmp);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment