diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index c3afa040f81c25ae7a747779be833b62300d83a8..fa48ebebe9cbf64c1132ab4fe0e1d0c81b01a8b8 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -293,7 +293,10 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask )
 		if (cur_focus)
 		{
 			LLUICtrl* focus_root = cur_focus->findRootMostFocusRoot();
-			handled = focus_root->focusPrevItem(FALSE);
+			if (focus_root)
+			{
+				handled = focus_root->focusPrevItem(FALSE);
+			}
 		}
 	}
 	else if( (mask == MASK_NONE ) && (KEY_TAB == key))	
@@ -302,7 +305,10 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask )
 		if (cur_focus)
 		{
 			LLUICtrl* focus_root = cur_focus->findRootMostFocusRoot();
-			handled = focus_root->focusNextItem(FALSE);
+			if (focus_root)
+			{
+				handled = focus_root->focusNextItem(FALSE);
+			}
 		}
 	}