diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp
index 7df5a3331392b28fc3d1986ab007526be6112c65..2f22512abaab65b06a73cf54e04087a9a80a4c9c 100644
--- a/indra/newview/llmoveview.cpp
+++ b/indra/newview/llmoveview.cpp
@@ -200,7 +200,7 @@ void LLFloaterMove::setFlyingMode(BOOL fly)
 	if (instance)
 	{
 		instance->setFlyingModeImpl(fly);
-		LLVOAvatarSelf* avatar_object = gAgent.getAvatarObject();
+		LLVOAvatarSelf* avatar_object = gAgentAvatarp;
 		bool is_sitting = avatar_object
 			&& (avatar_object->getRegion() != NULL)
 			&& (!avatar_object->isDead())