Fix possible crash

This commit is contained in:
Benau 2020-09-21 00:49:23 +08:00
parent 94f4a6f644
commit 2fc992ded9
2 changed files with 7 additions and 1 deletions

View File

@ -155,7 +155,7 @@ extern "C" void reset_network_body()
{ {
// In windows the rendering is paused when out focus, which pauses the // In windows the rendering is paused when out focus, which pauses the
// smooth timer // smooth timer
if (World::getWorld() && RewindManager::isEnabled()) if (World::getWorld() && RewindManager::exists())
RewindManager::get()->resetSmoothNetworkBody(); RewindManager::get()->resetSmoothNetworkBody();
} // reset_network_body } // reset_network_body

View File

@ -147,6 +147,12 @@ public:
/** Returns if rewinding is enabled or not. */ /** Returns if rewinding is enabled or not. */
static bool isEnabled() { return m_enable_rewind_manager; } static bool isEnabled() { return m_enable_rewind_manager; }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
static bool exists()
{
ProcessType pt = STKProcess::getType();
return m_rewind_manager[pt] != NULL;
} // exists
// ------------------------------------------------------------------------
/** Returns the singleton. This function will not automatically create /** Returns the singleton. This function will not automatically create
* the singleton. */ * the singleton. */
static RewindManager *get() static RewindManager *get()