b message parser

fix core dump when an event is called and no sim is active
This commit is contained in:
2024-08-27 11:10:39 +02:00
parent 162018b002
commit e56fe54853
+5
View File
@@ -64,6 +64,11 @@ void event_handler(json event)
{ {
std::string type = event["type"]; std::string type = event["type"];
Event e = magic_enum::enum_cast<Event>(type).value_or(Event::end); Event e = magic_enum::enum_cast<Event>(type).value_or(Event::end);
if (g_simulators->invoke_active_simulator() == nullptr)
{
spdlog::error("Event got called but there is no active simulator");
return;
}
switch(e) switch(e)
{ {