fix typeinfo_cast if passed a nullptr

This commit is contained in:
HJfod 2023-02-11 19:31:30 +02:00
parent 187e360201
commit f4a3258586

View file

@ -75,6 +75,10 @@ namespace geode::cast {
std::is_polymorphic_v<std::remove_pointer_t<Before>>, "Input is not a polymorphic type"
);
if (!ptr) {
return After();
}
auto basePtr = dynamic_cast<void*>(ptr);
auto vftable = *reinterpret_cast<VftableType**>(basePtr);