Skip to content

Commit c6cadbb

Browse files
committed
VTFMHook: pass not found vt
1 parent b662d58 commit c6cadbb

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

include/dynlibutils/vthook.hpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,13 +381,12 @@ class CVTFMHook : public CVTMHook<R, T, Args...>
381381
{
382382
auto found = sm_vcallbacks.find(CVirtualTable(pClass));
383383

384-
assert(found != sm_vcallbacks.cend());
385-
386-
auto &callbacks = found->second;
387-
388384
if constexpr (std::is_void_v<R>)
389385
{
390-
for (const auto &callback : callbacks)
386+
if (found == sm_vcallbacks.cend())
387+
return;
388+
389+
for (const auto &callback : found->second)
391390
{
392391
callback(pClass, args...);
393392
}
@@ -398,7 +397,10 @@ class CVTFMHook : public CVTMHook<R, T, Args...>
398397
{
399398
R result {};
400399

401-
for (const auto &callback : callbacks)
400+
if (found == sm_vcallbacks.cend())
401+
return result;
402+
403+
for (const auto &callback : found->second)
402404
{
403405
result = callback(pClass, args...);
404406
}

0 commit comments

Comments
 (0)