Index: Source/platform/Timer.cpp |
diff --git a/Source/platform/Timer.cpp b/Source/platform/Timer.cpp |
index 33f33481e0e166583ae9c0817637767e09da58e0..25ac67ec8bee57bb9e7b888d0ab245a5999861bb 100644 |
--- a/Source/platform/Timer.cpp |
+++ b/Source/platform/Timer.cpp |
@@ -46,7 +46,7 @@ TimerBase::TimerBase() |
, m_unalignedNextFireTime(0) |
, m_repeatInterval(0) |
, m_cancellableTimerTask(nullptr) |
- , m_webScheduler(Platform::current()->currentThread()->scheduler()) |
+ , m_webScheduler(Platform::current()->currentThread() ? Platform::current()->currentThread()->scheduler() : nullptr) |
#if ENABLE(ASSERT) |
, m_thread(currentThread()) |
#endif |
@@ -104,7 +104,8 @@ void TimerBase::setNextFireTime(double now, double delay) |
if (m_cancellableTimerTask) |
m_cancellableTimerTask->cancel(); |
m_cancellableTimerTask = new CancellableTimerTask(this); |
- m_webScheduler->postTimerTask(m_location, m_cancellableTimerTask, delayMs); |
+ if (m_webScheduler) |
+ m_webScheduler->postTimerTask(m_location, m_cancellableTimerTask, delayMs); |
} |
} |