Skip to content

Commit

Permalink
[pixeldata] Handle empty NumberOfFrames tags
Browse files Browse the repository at this point in the history
  • Loading branch information
abustany committed Oct 21, 2024
1 parent 287f84f commit 955a652
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pixeldata/src/attribute.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Utility module for fetching key attributes from a DICOM object.

use dicom_core::{DataDictionary, Tag};
use dicom_core::{header::HasLength, DataDictionary, Tag};
use dicom_dictionary_std::tags;
use dicom_object::{mem::InMemElement, FileDicomObject, InMemDicomObject};
use snafu::{ensure, Backtrace, OptionExt, ResultExt, Snafu};
Expand Down Expand Up @@ -279,6 +279,10 @@ pub fn number_of_frames<D: DataDictionary + Clone>(
return Ok(1);
};

if elem.is_empty() {
return Ok(1);
}

let integer = elem.to_int::<i32>().context(ConvertValueSnafu { name })?;

ensure!(
Expand Down

0 comments on commit 955a652

Please sign in to comment.