build: fix building with clang

This commit is contained in:
2024-12-01 17:09:58 +00:00
parent 4d594e9463
commit c5f4a1db71
3 changed files with 38 additions and 2 deletions

View File

@ -19,8 +19,8 @@ public:
template <typename T> static T* get() {
for (const auto& component_ : get_components()) {
if (typeid(*component_.get()) == typeid(T)) {
return reinterpret_cast<T*>(component_.get());
if (auto c = dynamic_cast<T*>(component_.get())) {
return c;
}
}