Skip to content

Commit

Permalink
Merge pull request #43 from TLATER/tlater/fix-eglot-crash
Browse files Browse the repository at this point in the history
Fix crashes when run with eglot as a client
  • Loading branch information
Strum355 authored Aug 18, 2022
2 parents 83c86ae + 05e52fc commit d1d1e23
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions server/main/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,14 +651,16 @@ impl LanguageServerHandling for MinecraftShaderLanguageServer {
log_level: String,
}

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

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

configuration::handle_log_level_change(config.log_level, |level| {
self.log_guard = None; // set to None so Drop is invoked
self.log_guard = Some(logging::set_logger_with_level(level));
})
configuration::handle_log_level_change(config.log_level, |level| {
self.log_guard = None; // set to None so Drop is invoked
self.log_guard = Some(logging::set_logger_with_level(level));
})
}
});
}

Expand Down

0 comments on commit d1d1e23

Please sign in to comment.