From 643ee4afa8a27983d8bf86a3fb865cc82d90b9e5 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Tue, 15 Oct 2019 23:14:29 -0400
Subject: [PATCH] Crash fixes.

---
 indra/newview/llsky.cpp          | 2 +-
 indra/newview/llsurfacepatch.cpp | 2 +-
 indra/newview/llworld.h          | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/indra/newview/llsky.cpp b/indra/newview/llsky.cpp
index 38da8f2868..e9eb02e45e 100644
--- a/indra/newview/llsky.cpp
+++ b/indra/newview/llsky.cpp
@@ -119,7 +119,7 @@ void LLSky::restoreGL()
 
 void LLSky::resetVertexBuffers()
 {
-	if (gSky.mVOSkyp.notNull())
+	if (gSky.mVOSkyp.notNull() && gSky.mVOGroundp.notNull())
 	{
 		gPipeline.resetVertexBuffers(gSky.mVOSkyp->mDrawable);
 		gPipeline.resetVertexBuffers(gSky.mVOGroundp->mDrawable);
diff --git a/indra/newview/llsurfacepatch.cpp b/indra/newview/llsurfacepatch.cpp
index 7f1a0feb27..922feff780 100644
--- a/indra/newview/llsurfacepatch.cpp
+++ b/indra/newview/llsurfacepatch.cpp
@@ -201,7 +201,7 @@ LLVector2 LLSurfacePatch::getTexCoords(const U32 x, const U32 y) const
 void LLSurfacePatch::eval(const U32 x, const U32 y, const U32 stride, LLVector3 *vertex, LLVector3 *normal,
 						  LLVector2 *tex0, LLVector2 *tex1)
 {
-	if (!mSurfacep || !mSurfacep->getRegion() || !mSurfacep->getGridsPerEdge())
+	if (!mSurfacep || !mSurfacep->getRegion() || !mSurfacep->getGridsPerEdge() || !mVObjp)
 	{
 		return; // failsafe
 	}
diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h
index 8390ec8b06..0319481675 100644
--- a/indra/newview/llworld.h
+++ b/indra/newview/llworld.h
@@ -245,7 +245,7 @@ private:
 	// Data for "Fake" objects
 	//
 
-	std::list<LLVOWater*> mHoleWaterObjects;
+	std::list<LLPointer<LLVOWater> > mHoleWaterObjects;
 	LLPointer<LLVOWater> mEdgeWaterObjects[8];
 
 	LLPointer<LLViewerTexture> mDefaultWaterTexturep;
-- 
GitLab