diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index f461c7e46fb4baa46bdc46ac2f5c31404f1230a8..c899e8991e195360d0aa89cf7ed10408068f26a8 100755
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -1620,7 +1620,7 @@ void LLMeshUploadThread::doWholeModelUpload()
 			mCurlRequest->process();
 			//sleep for 10ms to prevent eating a whole core
 			apr_sleep(10000);
-		} while (mCurlRequest->getQueued() > 0);
+		} while (!LLAppViewer::isQuitting() && mCurlRequest->getQueued() > 0);
 	}
 
 	delete mCurlRequest;