From 3db850a7d1870782a75606e682809758bc3e793a Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 3 Dec 2012 05:45:04 +0100 Subject: [PATCH] Don't crash if no loading screens are found --- apps/openmw/mwgui/loadingscreen.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwgui/loadingscreen.cpp b/apps/openmw/mwgui/loadingscreen.cpp index 8bcaa6ce0..d721e209a 100644 --- a/apps/openmw/mwgui/loadingscreen.cpp +++ b/apps/openmw/mwgui/loadingscreen.cpp @@ -226,9 +226,14 @@ namespace MWGui if (start == "splash") splash.push_back (*it); } - std::string randomSplash = splash[rand() % splash.size()]; + if (splash.size()) + { + std::string randomSplash = splash[rand() % splash.size()]; - Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton ().load (randomSplash, "General"); - mBackgroundImage->setImageTexture (randomSplash); + Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton ().load (randomSplash, "General"); + mBackgroundImage->setImageTexture (randomSplash); + } + else + std::cerr << "No loading screens found!" << std::endl; } }