diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index 83499cc9fcc2bdd76f0b9ee00ea8aee7baf16035..3f2d55d79db2bc451f67d8266bc03ac96d90ed55 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -37,20 +37,21 @@ namespace
 {
     LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment");
     LLTrace::BlockTimerStatHandle FTM_UPDATE_SKYVALUES("Update Sky Environment");    
+}
 
-    const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees
-    const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD);
-    const LLVector3 DUE_EAST = LLVector3::x_axis;
-
-    LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude)
-    {
-        LLQuaternion quat;
-        quat.setEulerAngles(0.0f, -altitude, azimuth);
-        return quat;
-    }
+static const F32 NIGHTTIME_ELEVATION     = -8.0f; // degrees
+static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD);
+static const LLVector3 DUE_EAST = LLVector3::x_axis;
+static const LLUUID IMG_BLOOM1("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef");
 
+static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude)
+{
+    LLQuaternion quat;
+    quat.setEulerAngles(0.0f, -altitude, azimuth);
+    return quat;
 }
 
+
 //=========================================================================
 const std::string LLSettingsSky::SETTING_AMBIENT("ambient");
 const std::string LLSettingsSky::SETTING_BLUE_DENSITY("blue_density");
@@ -389,14 +390,20 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf)
     llassert(getSettingsType() == end->getSettingsType());
 
     LLSettingsSky::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast<LLSettingsSky>(end);
-    LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf);
+    if (other)
+    {
+        LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf);
+        replaceSettings(blenddata);
+        mNextSunTextureId = other->getSunTextureId();
+        mNextMoonTextureId = other->getMoonTextureId();
+        mNextCloudTextureId = other->getCloudNoiseTextureId();
+    }
+    else
+    {
+        LL_WARNS("SETTINGS") << "Could not cast end settings to sky. No blend performed." << LL_ENDL;
+    }
 
-    replaceSettings(blenddata);
-    
     setBlendFactor(blendf);
-    mNextSunTextureId = other->getSunTextureId();
-    mNextMoonTextureId = other->getMoonTextureId();
-    mNextCloudTextureId = other->getCloudNoiseTextureId();
 }
 
 LLSettingsSky::stringset_t LLSettingsSky::getSkipInterpolateKeys() const
diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp
index a1e49290553421393bd83d8b4935c9fc8d179262..8eb65331ad8164e15fbdc1447960073b975ad5f6 100644
--- a/indra/llinventory/llsettingswater.cpp
+++ b/indra/llinventory/llsettingswater.cpp
@@ -173,12 +173,19 @@ LLSD LLSettingsWater::translateLegacySettings(LLSD legacy)
 void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf) 
 {
     LLSettingsWater::ptr_t other = PTR_NAMESPACE::static_pointer_cast<LLSettingsWater>(end);
-    LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf);
-    
-    replaceSettings(blenddata);
+    if (other)
+    {
+        LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf);
+        replaceSettings(blenddata);
+        mNextNormalMapID = other->getNormalMapID();
+        mNextTransparentTextureID = other->getTransparentTextureID();
+    }
+    else
+    {
+        LL_WARNS("SETTINGS") << "Cound not cast end settings to water. No blend performed." << LL_ENDL;
+    }
     setBlendFactor(blendf);
     mNextNormalMapID = other->getNormalMapID();
-    mNextTransparentTextureID = other->getTransparentTextureID();
 }
 
 LLSettingsWater::validation_list_t LLSettingsWater::getValidationList() const