Adds check for active simulator before commands

Implements a check to ensure a simulator is active before processing commands.

This prevents errors and unexpected behavior when commands are sent without an active simulator. The check is performed at the beginning of the command parsing, and logs an error if no simulator is active, returning an empty JSON object.
This commit is contained in:
2026-02-14 14:32:10 +01:00
parent fe0ee989e9
commit ee185b68e6
3 changed files with 16 additions and 0 deletions
+5
View File
@@ -151,6 +151,11 @@ std::vector<std::string> Simulators::list_simulators() const
return names;
}
bool Simulators::is_not_active() const
{
return this->m_current_simulator.empty();
}
Simulator_base *Simulators::invoke_active_simulator()
{
std::lock_guard<std::mutex> lock(m_mutex);