From 9a45f575c892b2fe56d4cbd0b2d25ab0dd303d6e Mon Sep 17 00:00:00 2001 From: AzureMarker Date: Tue, 11 Jan 2022 17:19:11 -0800 Subject: [PATCH] Add back initialization of default console in Console::drop If the default console isn't initialized then it will segfault. --- ctru-rs/src/console.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ctru-rs/src/console.rs b/ctru-rs/src/console.rs index 1a226b7..5c0b92a 100644 --- a/ctru-rs/src/console.rs +++ b/ctru-rs/src/console.rs @@ -65,7 +65,10 @@ impl Drop for Console { if std::ptr::eq(current_console, &*self.context) { // Console dropped while selected. We just replaced it with the - // default so there's nothing more to do. + // default so make sure it's initialized. + if !(*default_console).consoleInitialised { + ctru_sys::consoleInit(Screen::Top.into(), default_console); + } } else { // Console dropped while a different console was selected. Put back // the console that was selected.