From 884d306bf35f4f3b658602f0e1f972401795d1ff Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 4 Feb 2017 05:57:56 +0100 Subject: [PATCH] Throw exception when told to use 0 threads --- apps/openmw/mwrender/renderingmanager.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 1d257a9fc..7bb72ae5d 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -158,7 +158,6 @@ namespace MWRender : mViewer(viewer) , mRootNode(rootNode) , mResourceSystem(resourceSystem) - , mWorkQueue(new SceneUtil::WorkQueue(Settings::Manager::getInt("preload num threads", "Cells"))) , mUnrefQueue(new SceneUtil::UnrefQueue) , mFogDepth(0.f) , mUnderwaterColor(fallback->getFallbackColour("Water_UnderwaterColor")) @@ -169,6 +168,11 @@ namespace MWRender , mFieldOfViewOverride(0.f) , mFieldOfViewOverridden(false) { + int numThreads = Settings::Manager::getInt("preload num threads", "Cells"); + if (numThreads <= 0) + throw std::runtime_error("Invalid setting: 'preload num threads' must be >0"); + mWorkQueue = new SceneUtil::WorkQueue(numThreads); + resourceSystem->getSceneManager()->setParticleSystemMask(MWRender::Mask_ParticleSystem); resourceSystem->getSceneManager()->setShaderPath(resourcePath + "/shaders"); resourceSystem->getSceneManager()->setForceShaders(Settings::Manager::getBool("force shaders", "Shaders"));