From 1264651af73474a2da72a00c7e9e9553110efdd4 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 8 Dec 2015 21:12:05 +0100 Subject: [PATCH] Fix coverity defects --- apps/openmw/mwphysics/physicssystem.cpp | 2 +- apps/openmw/mwsound/openal_output.cpp | 6 +++--- apps/openmw/mwsound/soundmanagerimp.cpp | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index db010d0fb..eebfddaab 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -709,7 +709,7 @@ namespace MWPhysics bool PhysicsSystem::isOnSolidGround (const MWWorld::Ptr& actor) const { const Actor* physactor = getActor(actor); - if (!physactor->getOnGround()) + if (!physactor || !physactor->getOnGround()) return false; CollisionMap::const_iterator found = mStandingCollisions.find(actor); diff --git a/apps/openmw/mwsound/openal_output.cpp b/apps/openmw/mwsound/openal_output.cpp index c2e808dee..02a9f33f9 100644 --- a/apps/openmw/mwsound/openal_output.cpp +++ b/apps/openmw/mwsound/openal_output.cpp @@ -363,9 +363,9 @@ OpenAL_SoundStream::OpenAL_SoundStream(ALuint src, DecoderPtr decoder) switch(type) { - case SampleType_UInt8: mSilence = 0x80; - case SampleType_Int16: mSilence = 0x00; - case SampleType_Float32: mSilence = 0x00; + case SampleType_UInt8: mSilence = 0x80; break; + case SampleType_Int16: mSilence = 0x00; break; + case SampleType_Float32: mSilence = 0x00; break; } mFrameSize = framesToBytes(1, chans, type); diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index a13acf3e2..d12174e20 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -48,9 +48,6 @@ namespace MWSound , mListenerUp(0,0,1) , mPausedSoundTypes(0) { - if(!useSound) - return; - mMasterVolume = Settings::Manager::getFloat("master volume", "Sound"); mMasterVolume = std::min(std::max(mMasterVolume, 0.0f), 1.0f); mSFXVolume = Settings::Manager::getFloat("sfx volume", "Sound"); @@ -67,6 +64,9 @@ namespace MWSound mBufferCacheMax *= 1024*1024; mBufferCacheMin = std::min(mBufferCacheMin*1024*1024, mBufferCacheMax); + if(!useSound) + return; + std::string hrtfname = Settings::Manager::getString("hrtf", "Sound"); int hrtfstate = Settings::Manager::getInt("hrtf enable", "Sound");