From a8458e7995887fdf305f34bd0c2fc754e0ee2671 Mon Sep 17 00:00:00 2001 From: Timm Fitschen <t.fitschen@indiscale.com> Date: Thu, 23 Jun 2022 00:00:58 +0200 Subject: [PATCH] check for nullptr in configuration.cpp --- src/caosdb/configuration.cpp | 4 ++-- src/caosdb/utility.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/caosdb/configuration.cpp b/src/caosdb/configuration.cpp index d8a3050..4d893a7 100644 --- a/src/caosdb/configuration.cpp +++ b/src/caosdb/configuration.cpp @@ -468,7 +468,7 @@ auto ConfigurationManager::InitializeDefaults() -> int { // NOLINT } // 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")) { LoggingConfiguration logging_configuration = CreateLoggingConfiguration(WRAPPED_JSON_CONFIGURATION(this)->at("logging").as_object()); @@ -479,7 +479,7 @@ auto ConfigurationManager::InitializeDefaults() -> int { // NOLINT "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) << "."; } diff --git a/src/caosdb/utility.cpp b/src/caosdb/utility.cpp index 58d7c97..1329dca 100644 --- a/src/caosdb/utility.cpp +++ b/src/caosdb/utility.cpp @@ -147,7 +147,7 @@ auto load_json_file(const path &json_file) -> JsonValue { JsonValue::~JsonValue() { this->Reset(); } auto JsonValue::Reset() -> void { - void * tmp = std::move(this->wrapped); + void *tmp = std::move(this->wrapped); this->wrapped = nullptr; if (tmp != nullptr) { delete static_cast<value *>(tmp); -- GitLab