diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-05-15 09:15:57 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-05-15 09:15:57 -0400 |
commit | 6fcc9a0eae892a8bfc1079e100a37da7f781330b (patch) | |
tree | d8c5cb3ab9aaf52cf4ffa2bed92ff66d465fa2b4 /indra/llimage/llimagepng.cpp | |
parent | c3da5bb12d1c7c173929433589a4068555791bea (diff) | |
parent | bb3c36f5cbc0c3b542045fd27255eee24e03da22 (diff) |
Merge branch 'main' into release/luau-scripting for Maint X release.
Diffstat (limited to 'indra/llimage/llimagepng.cpp')
-rw-r--r-- | indra/llimage/llimagepng.cpp | 46 |
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())) + { + 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); } - - // Decode the PNG data and extract sizing information - LLPngWrapper pngWrapper; - if (!pngWrapper.isValidPng(getData())) + 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; } |