From 6b8c58e3b549df9bc58cb967689b0a548ae84aab Mon Sep 17 00:00:00 2001 From: Siana Gearz Date: Mon, 13 Aug 2012 06:14:16 +0200 Subject: [PATCH] Safe and probably pointless crash workarounds from FS and LL --- indra/llcommon/llstring.cpp | 2 +- indra/newview/llattachmentsmgr.cpp | 3 +++ indra/newview/lltexturefetch.cpp | 2 +- indra/newview/llviewertexture.cpp | 2 +- indra/newview/llvoavatar.cpp | 13 +++++++++++-- indra/newview/llvovolume.cpp | 3 +++ 6 files changed, 20 insertions(+), 5 deletions(-) diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index f00eefe90..15a4b3d77 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -53,7 +53,7 @@ std::string ll_safe_string(const char* in) std::string ll_safe_string(const char* in, S32 maxlen) { - if(in) return std::string(in, maxlen); + if(in && maxlen > 0) return std::string(in, maxlen); return std::string(); } diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index abca74796..c064fa5f4 100644 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -88,6 +88,9 @@ void LLAttachmentsMgr::onIdle(void *) void LLAttachmentsMgr::onIdle() { + if(!gAgent.getRegion()) + return; + S32 obj_count = mPendingAttachments.size(); if (obj_count == 0) { diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 1fa37f994..f507d22ba 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -931,7 +931,7 @@ void LLTextureFetchWorker::startWork(S32 param) // Called from LLWorkerThread::processRequest() bool LLTextureFetchWorker::doWork(S32 param) { - static const F32 FETCHING_TIMEOUT = 120.f;//seconds + static const F32 FETCHING_TIMEOUT = 15.f;//seconds LLMutexLock lock(&mWorkMutex); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 0455f18a7..cf54a6ce8 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1891,7 +1891,7 @@ void LLViewerFetchedTexture::updateVirtualSize() for(U32 i = 0 ; i < mNumFaces ; i++) { LLFace* facep = mFaceList[i] ; - if(facep->getDrawable()->isRecentlyVisible()) + if(facep && facep->getDrawable() && facep->getDrawable()->isRecentlyVisible()) { addTextureStats(facep->getVirtualSize()) ; setAdditionalDecodePriority(facep->getImportanceToCamera()) ; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 63aef9afc..c2f4d51e0 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -9700,8 +9700,17 @@ BOOL LLVOAvatar::isTextureDefined(LLVOAvatarDefines::ETextureIndex te, U32 index return FALSE; } - return (getImage(te, index)->getID() != IMG_DEFAULT_AVATAR && - getImage(te, index)->getID() != IMG_DEFAULT); + LLViewerTexture* img = getImage(te, index); + if(img) + { + return (img->getID() != IMG_DEFAULT_AVATAR && + img->getID() != IMG_DEFAULT); + } + else + { + llwarns << "Image doesn't exist" << llendl; + return FALSE; + } } //virtual diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index c9e38c270..4463e4062 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1153,6 +1153,9 @@ void LLVOVolume::updateFaceFlags() { for (S32 i = 0; i < getVolume()->getNumFaces(); i++) { + if(mDrawable->getNumFaces() <= i || getNumTEs() <= i) + return; + LLFace *face = mDrawable->getFace(i); if (face) {