diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index bd2da0760d..001d333887 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -788,7 +788,11 @@ void QCoreApplicationPrivate::init() #if QT_CONFIG(thread) #ifdef Q_OS_WASM - QThreadPrivate::idealThreadCount = emscripten::val::global("navigator")["hardwareConcurrency"].as(); + emscripten::val hardwareConcurrency = emscripten::val::global("navigator")["hardwareConcurrency"]; + if (hardwareConcurrency.isUndefined()) + QThreadPrivate::idealThreadCount = 2; + else + QThreadPrivate::idealThreadCount = hardwareConcurrency.as(); #endif #endif