diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 0ad54f238e537248adadc8d6909b28ffa7143f6b..5c262838aef80d05cf57b326473e466d5323359b 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -1820,7 +1820,7 @@ bool LLViewerFetchedTexture::updateFetch()
 	S32 current_discard = getCurrentDiscardLevelForFetching() ;
 	S32 desired_discard = getDesiredDiscardLevel();
 	F32 decode_priority = getDecodePriority();
-	decode_priority = llmax(decode_priority, 0.0f);
+	decode_priority = llclamp(decode_priority, 0.0f, maxDecodePriority());
 
 	if (mIsFetching)
 	{