Quickfix for panic (#10125)

This commit is contained in:
Adam Obuchowicz 2024-05-29 16:38:43 +02:00 committed by GitHub
parent 322662ee9d
commit e9452ea8ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -35,7 +35,7 @@ impl<'a> Changelog<'a> {
pub fn top_release_notes(&self) -> Result<Entry> { pub fn top_release_notes(&self) -> Result<Entry> {
let mut headers = self.iterate_headers(); let mut headers = self.iterate_headers();
let first_header = headers.next().context("Failed to find a level one header.")?; let first_header = headers.next().context("Failed to find a level one header.")?;
let file_end_pos = self.0.len() + 1; let file_end_pos = self.0.len();
let next_header_start = headers.next().map_or(file_end_pos, |h| h.pos.start); let next_header_start = headers.next().map_or(file_end_pos, |h| h.pos.start);
let contents = self.0[first_header.pos.end..next_header_start].trim(); let contents = self.0[first_header.pos.end..next_header_start].trim();
let entry = let entry =