Browse Source

properly handle nul termination in set_text

pull/162/head
Fenrir 10 months ago
parent
commit
b967440eb1
  1. 2
      ctru-rs/src/applets/error.rs

2
ctru-rs/src/applets/error.rs

@ -61,8 +61,8 @@ impl PopUp {
pub fn set_text(&mut self, text: &str) { pub fn set_text(&mut self, text: &str) {
for (idx, code_unit) in text for (idx, code_unit) in text
.encode_utf16() .encode_utf16()
.chain(std::iter::once(0))
.take(self.state.Text.len() - 1) .take(self.state.Text.len() - 1)
.chain(std::iter::once(0))
.enumerate() .enumerate()
{ {
self.state.Text[idx] = code_unit; self.state.Text[idx] = code_unit;

Loading…
Cancel
Save