Skip to content

Commit

Permalink
Revert to default config if null
Browse files Browse the repository at this point in the history
  • Loading branch information
hhvrc committed Oct 2, 2024
1 parent 3c45bbb commit bc9f706
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/config/EStopConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ void EStopConfig::ToDefault() {

bool EStopConfig::FromFlatbuffers(const Serialization::Configuration::EStopConfig* config) {
if (config == nullptr) {
OS_LOGE(TAG, "config is null");
return false;
ToDefault(); // Set to default if config is null
return true;
}

enabled = config->enabled();
Expand All @@ -44,8 +44,8 @@ flatbuffers::Offset<OpenShock::Serialization::Configuration::EStopConfig> EStopC

bool EStopConfig::FromJSON(const cJSON* json) {
if (json == nullptr) {
OS_LOGE(TAG, "json is null");
return false;
ToDefault(); // Set to default if config is null
return true;
}

if (cJSON_IsObject(json) == 0) {
Expand Down

1 comment on commit bc9f706

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-format reports: 1 file(s) not formatted
  • src/config/EStopConfig.cpp

Have any feedback or feature suggestions? Share it here.

Please sign in to comment.