summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorManos Pitsidianakis <el13635@mail.ntua.gr>2020-08-27 17:27:45 +0300
committerManos Pitsidianakis <el13635@mail.ntua.gr>2020-08-27 17:27:45 +0300
commitb94342c52bedff1ce77fb348351f9e2f1a6790d4 (patch)
tree572166e0aefd057e96d555ecb8398630b70d04d0 /src
parent75f59ee726919bc718c565efcf548422ced17587 (diff)
themes/regexp: fix unwrap check on regexp match byte offsets
Diffstat (limited to 'src')
-rw-r--r--src/conf/themes.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/conf/themes.rs b/src/conf/themes.rs
index 1c83262d..1568c587 100644
--- a/src/conf/themes.rs
+++ b/src/conf/themes.rs
@@ -609,8 +609,17 @@ mod regexp {
}
let next_byte_offset = next_byte_offset.unwrap();
- while next_byte_offset.start() < self.char_indices.next().unwrap().0 {
+ let mut next_char_index = self.char_indices.next();
+ if next_char_index.is_none() {
+ return None;
+ }
+
+ while next_byte_offset.start() < next_char_index.unwrap().0 {
self.char_offset += 1;
+ next_char_index = self.char_indices.next();
+ if next_char_index.is_none() {
+ return None;
+ }
}
let start = self.char_offset;