diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 9b28ab4bb5c84117c5149492a66a8c5bf550533b..0749093777bc86d7b1be80c5c2a8b8697c18e554 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -1403,7 +1403,10 @@ void LLFloater::moveResizeHandlesToFront()
 
 BOOL LLFloater::isFrontmost()
 {
-	return gFloaterView && gFloaterView->getFrontmost() == this && getVisible();
+	LLFloaterView* floater_view = getParentByType<LLFloaterView>();
+	return getVisible()
+			&& (floater_view 
+				&& floater_view->getFrontmost() == this);
 }
 
 void LLFloater::addDependentFloater(LLFloater* floaterp, BOOL reposition)