From cf204b74c51f7fcb2cca4ef62eaed2f52054ed24 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Sat, 12 Feb 2022 20:22:17 -0500
Subject: [PATCH] Fix rez under land group not falling back to current group
 tag id

---
 indra/newview/llagent.cpp | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 2f80193f3a2..6870dd0605a 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -5301,14 +5301,17 @@ LLUUID LLAgent::getGroupForRezzing()
 	if (gSavedSettings.getBOOL("AlchemyRezUnderLandGroup"))
 	{
 		LLParcel* land_parcel = LLViewerParcelMgr::getInstanceFast()->getAgentParcel();
-		// Is the agent in the land group
-		if (gAgent.isInGroup(land_parcel->getGroupID()))
-			return land_parcel->getGroupID();
-		// Is the agent in the land group (the group owns the land)
-		else if (gAgent.isInGroup(land_parcel->getOwnerID()))
-			return land_parcel->getOwnerID();
-	}
-	return LLUUID::null;
+		if (land_parcel)
+		{
+			// Is the agent in the land group
+			if (isInGroup(land_parcel->getGroupID()))
+				return land_parcel->getGroupID();
+			// Is the agent in the land group (the group owns the land)
+			else if (isInGroup(land_parcel->getOwnerID()))
+				return land_parcel->getOwnerID();
+		}
+	}
+	return getGroupID();
 }
 
 // EOF
-- 
GitLab