summaryrefslogtreecommitdiff
path: root/indra/llimage/llimagepng.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-05-15 12:27:46 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2024-05-15 12:27:46 +0300
commite59216443619dd2280ce0fff316a2b9e2ee7cf5e (patch)
tree27d782916858596d67a60ecf56ca07b6a44a4601 /indra/llimage/llimagepng.cpp
parentdcb85f9f9d1019bb046a5719bc3645fa96a2d060 (diff)
parentbb3c36f5cbc0c3b542045fd27255eee24e03da22 (diff)
Merge branch 'main' into release/maint-c
# Conflicts: # indra/llui/lltexteditor.cpp # indra/newview/llcontrolavatar.cpp
Diffstat (limited to 'indra/llimage/llimagepng.cpp')
-rw-r--r--indra/llimage/llimagepng.cpp46
1 files changed, 31 insertions, 15 deletions
diff --git a/indra/llimage/llimagepng.cpp b/indra/llimage/llimagepng.cpp
index 29a86f77f6..4d081ce169 100644
--- a/indra/llimage/llimagepng.cpp
+++ b/indra/llimage/llimagepng.cpp
@@ -27,6 +27,7 @@
#include "linden_common.h"
#include "stdtypes.h"
#include "llerror.h"
+#include "llexception.h"
#include "llimage.h"
#include "llpngwrapper.h"
@@ -51,30 +52,45 @@ bool LLImagePNG::updateData()
{
resetLastError();
- // Check to make sure that this instance has been initialized with data
- if (!getData() || (0 == getDataSize()))
+ try
{
- setLastError("Uninitialized instance of LLImagePNG");
- return false;
- }
+ // Check to make sure that this instance has been initialized with data
+ if (!getData() || (0 == getDataSize()))
+ {
+ setLastError("Uninitialized instance of LLImagePNG");
+ return false;
+ }
- // Decode the PNG data and extract sizing information
- LLPngWrapper pngWrapper;
- if (!pngWrapper.isValidPng(getData()))
+ // Decode the PNG data and extract sizing information
+ LLPngWrapper pngWrapper;
+ if (!pngWrapper.isValidPng(getData()))
+ {
+ setLastError("LLImagePNG data does not have a valid PNG header!");
+ return false;
+ }
+
+ LLPngWrapper::ImageInfo infop;
+ if (!pngWrapper.readPng(getData(), getDataSize(), NULL, &infop))
+ {
+ setLastError(pngWrapper.getErrorMessage());
+ return false;
+ }
+
+ setSize(infop.mWidth, infop.mHeight, infop.mComponents);
+ }
+ catch (const LLContinueError& msg)
{
- setLastError("LLImagePNG data does not have a valid PNG header!");
+ setLastError(msg.what());
+ LOG_UNHANDLED_EXCEPTION("");
return false;
}
-
- LLPngWrapper::ImageInfo infop;
- if (! pngWrapper.readPng(getData(), getDataSize(), NULL, &infop))
+ catch (...)
{
- setLastError(pngWrapper.getErrorMessage());
+ setLastError("LLImagePNG");
+ LOG_UNHANDLED_EXCEPTION("");
return false;
}
- setSize(infop.mWidth, infop.mHeight, infop.mComponents);
-
return true;
}