diff options
Diffstat (limited to 'src/construct/paragraph.rs')
-rw-r--r-- | src/construct/paragraph.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/construct/paragraph.rs b/src/construct/paragraph.rs index 134a4b5..3932ad8 100644 --- a/src/construct/paragraph.rs +++ b/src/construct/paragraph.rs @@ -118,10 +118,12 @@ pub fn resolve(tokenizer: &mut Tokenizer, map: &mut EditMap) -> bool { data_exit.index = line_ending_index; // Link Enter:Data on the previous line to Enter:Data on this line. - let data_enter_prev = &mut tokenizer.events[exit_index - 2]; - data_enter_prev.next = Some(enter_next_index + 1); - let data_enter_next = &mut tokenizer.events[enter_next_index + 1]; - data_enter_next.previous = Some(exit_index - 2); + if let Some(link) = &mut tokenizer.events[exit_index - 2].link { + link.next = Some(enter_next_index + 1); + } + if let Some(link) = &mut tokenizer.events[enter_next_index + 1].link { + link.previous = Some(exit_index - 2); + } // Potential next start. exit_index = enter_next_index + 3; |