Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

windows: Fix panic with some unicode characters (#10750)

张小白9863b920b0ef
diff --git a/crates/gpui/src/platform/windows/direct_write.rs b/crates/gpui/src/platform/windows/direct_write.rs
index 87b8921b43d..0cfc0ac914a 100644
--- a/crates/gpui/src/platform/windows/direct_write.rs
+++ b/crates/gpui/src/platform/windows/direct_write.rs
@@ -928,8 +928,11 @@ impl IDWriteTextRenderer_Impl for TextRenderer {
) -> windows::core::Result<()> {
unsafe {
let glyphrun = &*glyphrun;
- let desc = &*glyphrundescription;
let glyph_count = glyphrun.glyphCount as usize;
+ if glyph_count == 0 {
+ return Ok(());
+ }
+ let desc = &*glyphrundescription;
let utf16_length_per_glyph = desc.stringLength as usize / glyph_count;
let context =
&mut *(clientdrawingcontext as *const RendererContext as *mut RendererContext);