Skip to content

Commit

Permalink
Allow replacing objects during IOP load even if existing object type …
Browse files Browse the repository at this point in the history
  • Loading branch information
martonmiklos committed Jan 3, 2025
1 parent 6de17ef commit 035513f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace isobus
std::uint16_t get_object_pool_faulting_object_id();

protected:
/// @brief Adds an object to the object tree, and replaces an object of the same type
/// @brief Adds an object to the object tree, and replaces an object
/// if there's already one in the tree with the same ID.
/// @param[in] objectToAdd The object to add to the object tree
/// @returns true if the object was added or replaced, otherwise false
Expand Down
8 changes: 1 addition & 7 deletions isobus/src/isobus_virtual_terminal_working_set_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,11 @@ namespace isobus
{
bool retVal = false;

if ((nullptr != objectToAdd) &&
((!get_object_id_exists(objectToAdd->get_id())) ||
(objectToAdd->get_object_type() == vtObjectTree[objectToAdd->get_id()]->get_object_type())))
if (nullptr != objectToAdd)
{
vtObjectTree[objectToAdd->get_id()] = objectToAdd;
retVal = true;
}
else if (nullptr != objectToAdd)
{
CANStackLogger::error("[WS]: Cannot replace an object with duplicate ID %u with a different type of object." + isobus::to_string(static_cast<int>(objectToAdd->get_id())));
}
return retVal;
}

Expand Down

0 comments on commit 035513f

Please sign in to comment.