Skip to content

Commit

Permalink
Merge pull request #1840 from mheyse/fix/check-parameter-order
Browse files Browse the repository at this point in the history
fix: nullptr linter error
  • Loading branch information
proddy authored Jul 4, 2024
2 parents a0ca1ce + 8c810f2 commit 6b6224d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/modbus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ bool Modbus::check_parameter_order() {
for (const auto & mi : modbus_register_mappings) {
if (isFirst) {
isFirst = false;
} else if (prev == nullptr || !prev->isLessThan(mi)) {
// TODO fix nullptr dereference when printing
} else if (prev == nullptr) {
LOG_ERROR("Error checking modbus parameters %s.", mi.short_name);
return false;
} else if(!prev->isLessThan(mi)) {
LOG_ERROR("Error in modbus parameters: %s must be listed before %s.", mi.short_name, prev->short_name);
return false;
}
Expand Down

0 comments on commit 6b6224d

Please sign in to comment.