summaryrefslogtreecommitdiff
path: root/indra/llimage
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2020-02-11 00:56:15 +0200
committerAndrey Lihatskiy <alihatskiy@productengine.com>2020-02-11 00:56:15 +0200
commitec3d63cbf8d64d935f5660d8ae5a0f856627964c (patch)
tree3199eb90e34a4f74b9a2913e2b435723b1ec3371 /indra/llimage
parentee3ae8cb4abcb8e738d434fe15b97c628d6ca815 (diff)
parent2998552f3d7447da316afdd1713595528596a0c5 (diff)
Merge branch 'master' into DRTVWR-486
Diffstat (limited to 'indra/llimage')
-rw-r--r--indra/llimage/llimage.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp
index 9dea876114..7a0c8cd8f5 100644
--- a/indra/llimage/llimage.cpp
+++ b/indra/llimage/llimage.cpp
@@ -2168,19 +2168,27 @@ bool LLImageFormatted::load(const std::string &filename, int load_size)
}
bool res;
U8 *data = allocateData(load_size);
- apr_size_t bytes_read = load_size;
- apr_status_t s = apr_file_read(apr_file, data, &bytes_read); // modifies bytes_read
- if (s != APR_SUCCESS || (S32) bytes_read != load_size)
+ if (data)
{
- deleteData();
- setLastError("Unable to read file",filename);
- res = false;
+ apr_size_t bytes_read = load_size;
+ apr_status_t s = apr_file_read(apr_file, data, &bytes_read); // modifies bytes_read
+ if (s != APR_SUCCESS || (S32) bytes_read != load_size)
+ {
+ deleteData();
+ setLastError("Unable to read file",filename);
+ res = false;
+ }
+ else
+ {
+ res = updateData();
+ }
}
else
{
- res = updateData();
+ setLastError("Allocation failure", filename);
+ res = false;
}
-
+
return res;
}