From 7b6b14a992bb1927bb0ff56aa0966be83f3461aa Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 14 Apr 2024 15:37:23 +0200 Subject: [PATCH] avoid crash when chat "include" label doesn't exist --- src/chat.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/chat.rs b/src/chat.rs index a2e2460..f862fbf 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -190,7 +190,9 @@ impl ChatDB { for (index, label) in changes { if index < vector.len() { vector.remove(index); - vector.splice(index..index, include_db[&label].iter().cloned()); + if let Some(chat) = include_db.get(&label) { + vector.splice(index..index, chat.iter().cloned()); + } } } }