diff --git a/Engine/source/T3D/convexShape.cpp b/Engine/source/T3D/convexShape.cpp index 27a88ef79..aae119d8a 100644 --- a/Engine/source/T3D/convexShape.cpp +++ b/Engine/source/T3D/convexShape.cpp @@ -502,7 +502,7 @@ void ConvexShape::prepRenderImage( SceneRenderState *state ) } */ - if ( mVertexBuffer.isNull() ) + if ( mVertexBuffer.isNull() || !state) return; // If we don't have a material instance after the override then diff --git a/Engine/source/T3D/examples/renderMeshExample.cpp b/Engine/source/T3D/examples/renderMeshExample.cpp index 42a5ec950..42f48b049 100644 --- a/Engine/source/T3D/examples/renderMeshExample.cpp +++ b/Engine/source/T3D/examples/renderMeshExample.cpp @@ -269,7 +269,7 @@ void RenderMeshExample::prepRenderImage( SceneRenderState *state ) createGeometry(); // If we have no material then skip out. - if ( !mMaterialInst ) + if ( !mMaterialInst || !state) return; // If we don't have a material instance after the override then diff --git a/Engine/source/console/consoleObject.cpp b/Engine/source/console/consoleObject.cpp index 4469910d7..b5ca03189 100644 --- a/Engine/source/console/consoleObject.cpp +++ b/Engine/source/console/consoleObject.cpp @@ -847,12 +847,13 @@ DefineEngineFunction(linkNamespaces, bool, ( String childNSName, String parentNS Namespace *childNS = Namespace::find(childNSSTE); Namespace *parentNS = Namespace::find(parentNSSTE); - Namespace *currentParent = childNS->getParent(); if (!childNS) { return false; } + + Namespace *currentParent = childNS->getParent(); // Link to new NS if applicable diff --git a/Engine/source/gfx/D3D9/pc/gfxPCD3D9Device.cpp b/Engine/source/gfx/D3D9/pc/gfxPCD3D9Device.cpp index 4f0c280e2..3dfcfe1d4 100644 --- a/Engine/source/gfx/D3D9/pc/gfxPCD3D9Device.cpp +++ b/Engine/source/gfx/D3D9/pc/gfxPCD3D9Device.cpp @@ -66,7 +66,7 @@ void GFXPCD3D9Device::createDirect3D9(LPDIRECT3D9 &d3d9, LPDIRECT3D9EX &d3d9ex) if (pfnCreate9Ex) { - if (!FAILED(pfnCreate9Ex(D3D_SDK_VERSION, &d3d9ex)) && d3d9ex) + if (d3d9ex && !FAILED(pfnCreate9Ex(D3D_SDK_VERSION, &d3d9ex))) d3d9ex->QueryInterface(__uuidof(IDirect3D9), reinterpret_cast(&d3d9)); } diff --git a/Engine/source/gui/containers/guiWindowCtrl.cpp b/Engine/source/gui/containers/guiWindowCtrl.cpp index 63f741428..84be45148 100644 --- a/Engine/source/gui/containers/guiWindowCtrl.cpp +++ b/Engine/source/gui/containers/guiWindowCtrl.cpp @@ -1212,7 +1212,7 @@ void GuiWindowCtrl::onMouseUp(const GuiEvent &event) // We're either moving out of a collapse group or moving to another one // Not valid for windows not previously in a group if( mCollapseGroup >= 0 && - ( snapType == -1 || ( snapType >= 0 && mCollapseGroup != hitWindow->mCollapseGroup) ) ) + (snapType == -1 || (hitWindow && snapType >= 0 && mCollapseGroup != hitWindow->mCollapseGroup))) moveFromCollapseGroup(); // No window to connect to diff --git a/Engine/source/gui/core/guiControl.cpp b/Engine/source/gui/core/guiControl.cpp index fcbed44fa..9e75da03c 100644 --- a/Engine/source/gui/core/guiControl.cpp +++ b/Engine/source/gui/core/guiControl.cpp @@ -1755,41 +1755,48 @@ void GuiControl::write(Stream &stream, U32 tabStop, U32 flags) { //note: this will return false if either we, or any of our parents, are non-save controls bool bCanSave = ( flags & IgnoreCanSave ) || ( flags & NoCheckParentCanSave && getCanSave() ) || getCanSaveParent(); - StringTableEntry steName = mAddGroup->getInternalName(); - if(bCanSave && mAddGroup && (steName != NULL) && (steName != StringTable->insert("null")) && getName() ) + + if (bCanSave && mAddGroup) { - MutexHandle handle; - handle.lock(mMutex); + StringTableEntry steName = mAddGroup->getInternalName(); - // export selected only? - if((flags & SelectedOnly) && !isSelected()) + if ((steName != NULL) && (steName != StringTable->insert("null")) && getName()) { - for(U32 i = 0; i < size(); i++) - (*this)[i]->write(stream, tabStop, flags); + MutexHandle handle; + handle.lock(mMutex); + + // export selected only? + if ((flags & SelectedOnly) && !isSelected()) + { + for (U32 i = 0; i < size(); i++) + (*this)[i]->write(stream, tabStop, flags); + + return; + + } + + stream.writeTabs(tabStop); + char buffer[1024]; + dSprintf(buffer, sizeof(buffer), "new %s(%s,%s) {\r\n", getClassName(), getName() ? getName() : "", mAddGroup->getInternalName()); + stream.write(dStrlen(buffer), buffer); + writeFields(stream, tabStop + 1); + + if (size()) + { + stream.write(2, "\r\n"); + for (U32 i = 0; i < size(); i++) + (*this)[i]->write(stream, tabStop + 1, flags); + } + + stream.writeTabs(tabStop); + stream.write(4, "};\r\n"); return; - } - - stream.writeTabs(tabStop); - char buffer[1024]; - dSprintf(buffer, sizeof(buffer), "new %s(%s,%s) {\r\n", getClassName(), getName() ? getName() : "", mAddGroup->getInternalName()); - stream.write(dStrlen(buffer), buffer); - writeFields(stream, tabStop + 1); - - if(size()) - { - stream.write(2, "\r\n"); - for(U32 i = 0; i < size(); i++) - (*this)[i]->write(stream, tabStop + 1, flags); - } - - stream.writeTabs(tabStop); - stream.write(4, "};\r\n"); } - else if (bCanSave) + + if (bCanSave) Parent::write( stream, tabStop, flags ); - } //============================================================================= diff --git a/Engine/source/gui/worldEditor/worldEditor.cpp b/Engine/source/gui/worldEditor/worldEditor.cpp index f0755a70b..0273ffeb4 100644 --- a/Engine/source/gui/worldEditor/worldEditor.cpp +++ b/Engine/source/gui/worldEditor/worldEditor.cpp @@ -2655,7 +2655,7 @@ void WorldEditor::renderScene( const RectI &updateRect ) // Probably should test the entire icon screen-rect instead of just the centerpoint // but would need to move some code from renderScreenObj to here. - if ( mDragSelect ) + if (mDragSelect && selection) if ( mDragRect.pointInRect(sPosI) && !selection->objInSet(obj) ) mDragSelected->addObject(obj); diff --git a/Engine/source/postFx/postEffect.cpp b/Engine/source/postFx/postEffect.cpp index 000bf1600..62c35baf6 100644 --- a/Engine/source/postFx/postEffect.cpp +++ b/Engine/source/postFx/postEffect.cpp @@ -737,7 +737,7 @@ void PostEffect::_setupConstants( const SceneRenderState *state ) mShaderConsts->set( mMatPrevScreenToWorldSC, tempMat ); } - if ( mAmbientColorSC->isValid() ) + if (mAmbientColorSC->isValid() && state) { const ColorF &sunlight = state->getAmbientLightColor(); Point3F ambientColor( sunlight.red, sunlight.green, sunlight.blue ); diff --git a/Engine/source/renderInstance/renderPrePassMgr.cpp b/Engine/source/renderInstance/renderPrePassMgr.cpp index 4bf1870f1..35bbbaf07 100644 --- a/Engine/source/renderInstance/renderPrePassMgr.cpp +++ b/Engine/source/renderInstance/renderPrePassMgr.cpp @@ -203,12 +203,11 @@ void RenderPrePassMgr::addElement( RenderInst *inst ) matInst = static_cast(inst)->matInst; // Skip decals if they don't have normal maps. - if ( isDecalMeshInst && !matInst->hasNormalMap() ) + if (!matInst || isDecalMeshInst && !matInst->hasNormalMap()) return; // If its a custom material and it refracts... skip it. - if ( matInst && - matInst->isCustomMaterial() && + if ( matInst->isCustomMaterial() && static_cast( matInst->getMaterial() )->mRefract ) return;