From a68864c2a1b2c2d1a928cd8d53b962d78e927973 Mon Sep 17 00:00:00 2001 From: Adrian Del Grosso <10929341+ad3154@users.noreply.github.com> Date: Tue, 12 Dec 2023 19:08:33 -0700 Subject: [PATCH] Check if working sets are selectable before allowing them to be selected --- README.md | 2 +- src/ServerMainComponent.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 85d2017..c7d03cd 100644 --- a/README.md +++ b/README.md @@ -37,13 +37,13 @@ Supported features: - Logging - Multiple simultaneous VT clients - Selecting different working sets +- Most common macro and extended macro functionality Unimplemented features (for now) - Arbitrary audio control functionality - Window masks (tolerated in the object pool though) - Aux N/O -- Most macro functionality - Animations - Output Lists - Output arched bar graph diff --git a/src/ServerMainComponent.cpp b/src/ServerMainComponent.cpp index 42d8001..af508f9 100644 --- a/src/ServerMainComponent.cpp +++ b/src/ServerMainComponent.cpp @@ -408,7 +408,11 @@ void ServerMainComponent::timerCallback() send_end_of_object_pool_response(true, isobus::NULL_OBJECT_ID, isobus::NULL_OBJECT_ID, 0, ws->get_control_function()); } workingSetSelector.add_working_set_to_draw(ws); - if (isobus::NULL_CAN_ADDRESS == activeWorkingSetMasterAddress) + + auto workingSetObject = std::static_pointer_cast(ws->get_working_set_object()); + if ((isobus::NULL_CAN_ADDRESS == activeWorkingSetMasterAddress) && + (nullptr != workingSetObject) && + (workingSetObject->get_selectable())) { ws->set_working_set_maintenance_message_timestamp_ms(isobus::SystemTiming::get_timestamp_ms()); change_selected_working_set(0); @@ -722,7 +726,8 @@ std::shared_ptr ServerMainComponent::get_client_control void ServerMainComponent::change_selected_working_set(std::uint8_t index) { - if (index < managedWorkingSetList.size()) + if ((index < managedWorkingSetList.size()) && + (std::static_pointer_cast(managedWorkingSetList.at(index)->get_working_set_object())->get_selectable())) { bool lProcessActivateDeactivateMacros = false;