Skip to content

Commit d1d1e23

Browse files
authored
Merge pull request #43 from TLATER/tlater/fix-eglot-crash
Fix crashes when run with eglot as a client
2 parents 83c86ae + 05e52fc commit d1d1e23

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

server/main/src/main.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -651,14 +651,16 @@ impl LanguageServerHandling for MinecraftShaderLanguageServer {
651651
log_level: String,
652652
}
653653

654-
let config: Configuration = from_value(params.settings.as_object().unwrap().get("mcglsl").unwrap().to_owned()).unwrap();
654+
if let Some(settings) = params.settings.as_object().unwrap().get("mcglsl") {
655+
let config: Configuration = from_value(settings.to_owned()).unwrap();
655656

656-
info!("got updated configuration"; "config" => params.settings.as_object().unwrap().get("mcglsl").unwrap().to_string());
657+
info!("got updated configuration"; "config" => params.settings.as_object().unwrap().get("mcglsl").unwrap().to_string());
657658

658-
configuration::handle_log_level_change(config.log_level, |level| {
659-
self.log_guard = None; // set to None so Drop is invoked
660-
self.log_guard = Some(logging::set_logger_with_level(level));
661-
})
659+
configuration::handle_log_level_change(config.log_level, |level| {
660+
self.log_guard = None; // set to None so Drop is invoked
661+
self.log_guard = Some(logging::set_logger_with_level(level));
662+
})
663+
}
662664
});
663665
}
664666

0 commit comments

Comments
 (0)