Safe and probably pointless crash workarounds from FS and LL

This commit is contained in:
Siana Gearz
2012-08-13 06:14:16 +02:00
parent 7335ae548c
commit 6b8c58e3b5
6 changed files with 20 additions and 5 deletions

View File

@@ -53,7 +53,7 @@ std::string ll_safe_string(const char* in)
std::string ll_safe_string(const char* in, S32 maxlen) 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(); return std::string();
} }

View File

@@ -88,6 +88,9 @@ void LLAttachmentsMgr::onIdle(void *)
void LLAttachmentsMgr::onIdle() void LLAttachmentsMgr::onIdle()
{ {
if(!gAgent.getRegion())
return;
S32 obj_count = mPendingAttachments.size(); S32 obj_count = mPendingAttachments.size();
if (obj_count == 0) if (obj_count == 0)
{ {

View File

@@ -931,7 +931,7 @@ void LLTextureFetchWorker::startWork(S32 param)
// Called from LLWorkerThread::processRequest() // Called from LLWorkerThread::processRequest()
bool LLTextureFetchWorker::doWork(S32 param) bool LLTextureFetchWorker::doWork(S32 param)
{ {
static const F32 FETCHING_TIMEOUT = 120.f;//seconds static const F32 FETCHING_TIMEOUT = 15.f;//seconds
LLMutexLock lock(&mWorkMutex); LLMutexLock lock(&mWorkMutex);

View File

@@ -1891,7 +1891,7 @@ void LLViewerFetchedTexture::updateVirtualSize()
for(U32 i = 0 ; i < mNumFaces ; i++) for(U32 i = 0 ; i < mNumFaces ; i++)
{ {
LLFace* facep = mFaceList[i] ; LLFace* facep = mFaceList[i] ;
if(facep->getDrawable()->isRecentlyVisible()) if(facep && facep->getDrawable() && facep->getDrawable()->isRecentlyVisible())
{ {
addTextureStats(facep->getVirtualSize()) ; addTextureStats(facep->getVirtualSize()) ;
setAdditionalDecodePriority(facep->getImportanceToCamera()) ; setAdditionalDecodePriority(facep->getImportanceToCamera()) ;

View File

@@ -9700,8 +9700,17 @@ BOOL LLVOAvatar::isTextureDefined(LLVOAvatarDefines::ETextureIndex te, U32 index
return FALSE; return FALSE;
} }
return (getImage(te, index)->getID() != IMG_DEFAULT_AVATAR && LLViewerTexture* img = getImage(te, index);
getImage(te, index)->getID() != IMG_DEFAULT); if(img)
{
return (img->getID() != IMG_DEFAULT_AVATAR &&
img->getID() != IMG_DEFAULT);
}
else
{
llwarns << "Image doesn't exist" << llendl;
return FALSE;
}
} }
//virtual //virtual

View File

@@ -1153,6 +1153,9 @@ void LLVOVolume::updateFaceFlags()
{ {
for (S32 i = 0; i < getVolume()->getNumFaces(); i++) for (S32 i = 0; i < getVolume()->getNumFaces(); i++)
{ {
if(mDrawable->getNumFaces() <= i || getNumTEs() <= i)
return;
LLFace *face = mDrawable->getFace(i); LLFace *face = mDrawable->getFace(i);
if (face) if (face)
{ {