mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-14 20:40:03 +02:00
Avoid potential UB in loggers using composition
This cast would work fine, but any other fields added to those loggers would be left uninitialized.
This commit is contained in:
@@ -254,7 +254,8 @@ class EventHandler : public AdHocSocketHandler<Thread> {
|
||||
};
|
||||
|
||||
this->receive_multi(
|
||||
logging ? std::optional(std::ref(logging->first)) : std::nullopt,
|
||||
logging ? std::optional(std::ref(logging->first.logger))
|
||||
: std::nullopt,
|
||||
[&](boost::asio::local::stream_protocol::socket& socket) {
|
||||
process_event(socket, true);
|
||||
},
|
||||
|
||||
@@ -174,9 +174,10 @@ class Vst3MessageHandler : public AdHocSocketHandler<Thread> {
|
||||
write_object(socket, response);
|
||||
};
|
||||
|
||||
this->receive_multi(
|
||||
logging ? std::optional(std::ref(logging->first)) : std::nullopt,
|
||||
process_message);
|
||||
this->receive_multi(logging
|
||||
? std::optional(std::ref(logging->first.logger))
|
||||
: std::nullopt,
|
||||
process_message);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user