[FEATURE] In AbstractByteBuffer: more detailed error message

This commit is contained in:
hasherezade
2022-09-07 21:36:57 +02:00
parent 0385d7c840
commit 302c51580e
+6 -4
View File
@@ -70,12 +70,14 @@ BYTE* AbstractByteBuffer::getContentAt(offset_t offset, bufsize_t size, bool all
if (buf == NULL) return NULL;
if (offset >= fileSize ) {
if (allowExceptions) throw BufferException("Too far offset requested!");
if (allowExceptions) throw BufferException("Too far offset requested! Buffer size: "
+ QString::number(fileSize) + " vs reguested Offset: " + QString::number(offset));
return NULL;
}
if (offset + size > fileSize) {
if (allowExceptions) throw BufferException("Too big size requested!");
offset_t endOffset = offset + size;
if (endOffset > fileSize) {
if (allowExceptions) throw BufferException("Too big size requested! Buffer size: "
+ QString::number(fileSize) + " vs requested Size: " + QString::number(endOffset));
return NULL;
}
BYTE *cntnt = buf + offset;