[Bf-blender-cvs] [b5390a4aeeb] master: Fix assert on blend file load when seek fails
Campbell Barton
noreply at git.blender.org
Mon Jan 9 12:07:36 CET 2023
Commit: b5390a4aeeb71671d282e244b422a7e065abfff5
Author: Campbell Barton
Date: Mon Jan 9 22:03:14 2023 +1100
Branches: master
https://developer.blender.org/rBb5390a4aeeb71671d282e244b422a7e065abfff5
Fix assert on blend file load when seek fails
Only assert seek worked as expected when it doesn't return an error.
===================================================================
M source/blender/blenloader/intern/readfile.cc
===================================================================
diff --git a/source/blender/blenloader/intern/readfile.cc b/source/blender/blenloader/intern/readfile.cc
index ed88495797d..91a72fb50c4 100644
--- a/source/blender/blenloader/intern/readfile.cc
+++ b/source/blender/blenloader/intern/readfile.cc
@@ -724,13 +724,15 @@ static BHeadN *get_bhead(FileData *fd)
new_bhead->has_data = false;
new_bhead->is_memchunk_identical = false;
new_bhead->bhead = bhead;
- off64_t seek_new = fd->file->seek(fd->file, bhead.len, SEEK_CUR);
- if (seek_new == -1) {
+ const off64_t seek_new = fd->file->seek(fd->file, bhead.len, SEEK_CUR);
+ if (UNLIKELY(seek_new == -1)) {
fd->is_eof = true;
MEM_freeN(new_bhead);
new_bhead = nullptr;
}
- BLI_assert(fd->file->offset == seek_new);
+ else {
+ BLI_assert(fd->file->offset == seek_new);
+ }
}
else {
fd->is_eof = true;
More information about the Bf-blender-cvs
mailing list