From 18775f5d67245f238e7f7851e1875f44e953caf5 Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Mon, 9 Mar 2020 17:48:02 -0700 Subject: [PATCH] fix ginit error --- src/bridge/mod.rs | 5 +++-- src/renderer/caching_shaper.rs | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/bridge/mod.rs b/src/bridge/mod.rs index 1de9360..d2ab218 100644 --- a/src/bridge/mod.rs +++ b/src/bridge/mod.rs @@ -92,8 +92,9 @@ async fn start_process(mut receiver: UnboundedReceiver) { options.set_rgb(true); nvim.ui_attach(width as i64, height as i64, &options).await .unwrap_or_explained_panic("Could not attach ui to neovim process"); - nvim.command("runtime! ginit.vim").await - .unwrap_or_explained_panic("Could not add ginit.vim to runtime"); + if let Err(command_error) = nvim.command("runtime! ginit.vim").await { + nvim.command("echomsg \"error encountered in ginit.vim\"").await.ok(); + } info!("Neovim process attached"); let nvim = Arc::new(nvim); diff --git a/src/renderer/caching_shaper.rs b/src/renderer/caching_shaper.rs index 73f49c6..f176e1d 100644 --- a/src/renderer/caching_shaper.rs +++ b/src/renderer/caching_shaper.rs @@ -186,7 +186,7 @@ impl CachingShaper { } fn get_skia_font(&mut self, skribo_font: &SkriboFont) -> Option<&SkiaFont> { - let font_name = skribo_font.font.postscript_name().unwrap(); + let font_name = skribo_font.font.postscript_name()?; if !self.font_cache.contains(&font_name) { let font = build_skia_font_from_skribo_font(skribo_font, self.base_size)?; self.font_cache.put(font_name.clone(), font); @@ -222,6 +222,8 @@ impl CachingShaper { positions[i] = glyph.offset.x; } blobs.push(blob_builder.make().unwrap()); + } else { + warn!("Could not load scribo font"); } }