Skip to content

Commit

Permalink
make isGuiThread safe to run if QCoreApplication is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
pajlada committed Feb 13, 2021
1 parent bf645f1 commit 8f4126b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/debug/AssertInGuiThread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ namespace chatterino {

static bool isGuiThread()
{
return QCoreApplication::instance()->thread() == QThread::currentThread();
auto instance = QCoreApplication::instance();

if (instance != nullptr)
{
return instance->thread() == QThread::currentThread();
}

return false;
}

static void assertInGuiThread()
Expand Down

0 comments on commit 8f4126b

Please sign in to comment.