Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lofty/src/util/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ const EMPTY_DECODED_TEXT: DecodeTextResult = DecodeTextResult {
bom: [0, 0],
};

const EMPTY_DECODED_TEXT_TERMINATED: DecodeTextResult = DecodeTextResult {
content: String::new(),
bytes_read: 1,
bom: [0, 0],
};

/// Specify how to decode the provided text
///
/// By default, this will:
Expand Down Expand Up @@ -131,7 +137,7 @@ where
let (bytes, terminator_len) = read_to_terminator(reader, options.encoding);

if bytes.is_empty() {
return Ok(EMPTY_DECODED_TEXT);
return Ok(EMPTY_DECODED_TEXT_TERMINATED);
}

bytes_read = bytes.len() + terminator_len;
Expand Down
Loading