From b967440eb15f37c2257963a425239257aecfe03f Mon Sep 17 00:00:00 2001 From: Fenrir Date: Mon, 26 Feb 2024 19:36:33 -0700 Subject: [PATCH] properly handle nul termination in set_text --- ctru-rs/src/applets/error.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ctru-rs/src/applets/error.rs b/ctru-rs/src/applets/error.rs index 44fff08..8e323be 100644 --- a/ctru-rs/src/applets/error.rs +++ b/ctru-rs/src/applets/error.rs @@ -61,8 +61,8 @@ impl PopUp { pub fn set_text(&mut self, text: &str) { for (idx, code_unit) in text .encode_utf16() - .chain(std::iter::once(0)) .take(self.state.Text.len() - 1) + .chain(std::iter::once(0)) .enumerate() { self.state.Text[idx] = code_unit;