mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-27 01:45:35 -05:00
fix typeinfo_cast if passed a nullptr
This commit is contained in:
parent
187e360201
commit
f4a3258586
1 changed files with 4 additions and 0 deletions
|
@ -75,6 +75,10 @@ namespace geode::cast {
|
||||||
std::is_polymorphic_v<std::remove_pointer_t<Before>>, "Input is not a polymorphic type"
|
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 basePtr = dynamic_cast<void*>(ptr);
|
||||||
auto vftable = *reinterpret_cast<VftableType**>(basePtr);
|
auto vftable = *reinterpret_cast<VftableType**>(basePtr);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue