diff --git a/engine/flutter/fml/thread.cc b/engine/flutter/fml/thread.cc index c4645846d29d7a02f6d4c1c86378364fbf7da100..cb371e3fb8d8bdbf98b5ea8d5b8898ba0ad8522f 100644 --- a/engine/flutter/fml/thread.cc +++ b/engine/flutter/fml/thread.cc @@ -51,7 +51,11 @@ void Thread::Join() { return; } joined_ = true; - task_runner_->PostTask([]() { MessageLoop::GetCurrent().Terminate(); }); + task_runner_->PostTask([]() { + if (fml::MessageLoop::IsInitializedForCurrentThread()) { + MessageLoop::GetCurrent().Terminate(); + } + }); thread_->join(); }