mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2026-11-03 10:30:16 +01:00
added check to prevent segfault on missing subfile
This commit is contained in:
1 parent
19c6a4091f
commit
cee0d71b9c
3 files changed
+45
-7
No files matched your search
+6
-3
@@ -400,10 +400,13 @@ void RawFile::read_into(std::byte *image_buf, size_t n_frames) {
|
||||
}
|
||||
|
||||
size_t RawFile::frame_number(size_t frame_index) {
|
||||
if (frame_index > this->m_total_frames) {
|
||||
throw std::runtime_error(LOCATION + "Frame number out of range");
|
||||
if (frame_index >= this->m_total_frames) {
|
||||
throw std::runtime_error(LOCATION + " Frame number out of range");
|
||||
}
|
||||
size_t subfile_id = frame_index / this->max_frames_per_file;
|
||||
if(subfile_id >= this->subfiles.size()){
|
||||
throw std::runtime_error(LOCATION + " Subfile out of range. Possible missing data.");
|
||||
}
|
||||
size_t const subfile_id = frame_index / this->max_frames_per_file;
|
||||
return this->subfiles[subfile_id][0]->frame_number(frame_index % this->max_frames_per_file);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user