From 76c6f3f002693459b77669df39d51fb4e456650d Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Wed, 7 Dec 2022 21:18:42 +0200
Subject: SL-18741 Don't allow bulk upload without caps

---
 indra/newview/lldrawpoolwlsky.cpp  | 4 ++--
 indra/newview/llmaterialeditor.cpp | 8 +++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index c71d466830..9fe1b64d3d 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -354,7 +354,7 @@ void LLDrawPoolWLSky::renderStarsDeferred(const LLVector3& camPosLocal) const
 
 void LLDrawPoolWLSky::renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const
 {
-	if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && gSky.mVOSkyp->getCloudNoiseTex())
+	if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && gSky.mVOSkyp && gSky.mVOSkyp->getCloudNoiseTex())
 	{
         LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
 
@@ -408,7 +408,7 @@ void LLDrawPoolWLSky::renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32
 
 void LLDrawPoolWLSky::renderSkyClouds(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const
 {
-	if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && gSky.mVOSkyp->getCloudNoiseTex())
+	if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && gSky.mVOSkyp && gSky.mVOSkyp->getCloudNoiseTex())
 	{
         LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
 
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index 903ca60350..2e57c35326 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -1559,6 +1559,12 @@ void LLMaterialEditor::refreshFromInventory(const LLUUID& new_item_id)
 
 void LLMaterialEditor::onClickSaveAs()
 {
+    if (!LLMaterialEditor::capabilitiesAvailable())
+    {
+        LLNotificationsUtil::add("MissingMaterialCaps");
+        return;
+    }
+
     if (!can_afford_transaction(mExpectedUploadCost))
     {
         LLSD args;
@@ -1709,7 +1715,7 @@ static void pack_textures(
 
 void LLMaterialEditor::uploadMaterialFromFile(const std::string& filename, S32 index)
 {
-    if (index < 0)
+    if (index < 0 || !LLMaterialEditor::capabilitiesAvailable())
     {
         return;
     }
-- 
cgit v1.2.3