Commit 8f219a7c04

8f219a7c04332f896a357611c14d814eda2dca94

parent: e869ad308d

Unsigned

Darafei Praliaskouski <me@komzpa.net> · 2026-06-30 15:03 UTC
committer: <strk@kbt.io>

fix: avoid panicking on homeserver option checks

Treat homeserver expression evaluation failure as a failed option check instead of panicking while WeeChat validates the value.

Layout: unified · split

src/server.rs +7 −7
@@ -385,21 +385,21 @@ impl MatrixServer {
385385 let homeserver =
386386 StringOptionSettings::new(format!("{}.homeserver", server_name))
387387 .set_check_callback(|_, _, value| {
388 let url = Weechat::eval_string_expression(&value)
389 .expect("Can't evaluate homeserver");
390
391 MatrixServer::is_url_valid(&url)
388 Weechat::eval_string_expression(&value)
389 .map(|value| MatrixServer::is_url_valid(&value))
390 .unwrap_or(false)
392391 })
393392 .set_change_callback(move |_, option| {
394393 let server_ref = server.upgrade().expect(
395394 "Server got deleted while server config is alive",
396395 );
397396
398 let url = Weechat::eval_string_expression(&option.value())
399 .expect("Can't evaluate homeserver");
397 let homeserver =
398 Weechat::eval_string_expression(&option.value())
399 .expect("Can't evaluate homeserver");
400400
401401 server_ref.settings.borrow_mut().homeserver =
402 MatrixServer::parse_url_unchecked(&url);
402 MatrixServer::parse_url_unchecked(&homeserver);
403403 });
404404
405405 server_section