diff --git a/indra/newview/llviewerinput.cpp b/indra/newview/llviewerinput.cpp
index 3f8e6f57f653ddb243ab09c557d1b5ef8889a677..aac0cba92ea3a624b0d5c3ae960dc8e6005ca209 100644
--- a/indra/newview/llviewerinput.cpp
+++ b/indra/newview/llviewerinput.cpp
@@ -1028,7 +1028,7 @@ bool LLViewerInput::modeFromString(const std::string& string, S32 *mode)
 	}
 
     S32 val = atoi(string.c_str());
-    if (val >= 0 || val < MODE_COUNT)
+    if (val >= 0 && val < MODE_COUNT)
     {
         *mode = val;
         return true;