From e78d8653cebc1803f669c238b2e42300717af7c8 Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Thu, 2 Mar 2023 19:47:33 +0000 Subject: [PATCH] [wasm-rust] panic if buffer_set_contents fails --- src/wasm/rust/harfbuzz-wasm/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wasm/rust/harfbuzz-wasm/src/lib.rs b/src/wasm/rust/harfbuzz-wasm/src/lib.rs index 61e9da9bf..c33479c59 100644 --- a/src/wasm/rust/harfbuzz-wasm/src/lib.rs +++ b/src/wasm/rust/harfbuzz-wasm/src/lib.rs @@ -304,7 +304,9 @@ impl Drop for Buffer { position: positions[..].as_mut_ptr(), }; unsafe { - buffer_set_contents(self._ptr, &c_contents); + if !buffer_set_contents(self._ptr, &c_contents) { + panic!("Couldn't set buffer contents"); + } } } }