Browse Source

Use addr_of_mut! when referring to EMPTY_CONSOLE

pull/159/head
Fenrir 10 months ago
parent
commit
684bfb3251
  1. 4
      ctru-rs/src/console.rs

4
ctru-rs/src/console.rs

@ -143,7 +143,7 @@ impl<'screen> Console<'screen> {
/// ``` /// ```
pub fn exists() -> bool { pub fn exists() -> bool {
unsafe { unsafe {
let current_console = ctru_sys::consoleSelect(&mut EMPTY_CONSOLE); let current_console = ctru_sys::consoleSelect(std::ptr::addr_of_mut!(EMPTY_CONSOLE));
let res = (*current_console).consoleInitialised; let res = (*current_console).consoleInitialised;
@ -364,7 +364,7 @@ impl Drop for Console<'_> {
// the screen, but it won't crash either. // the screen, but it won't crash either.
// Get the current console by replacing it with an empty one. // Get the current console by replacing it with an empty one.
let current_console = ctru_sys::consoleSelect(&mut EMPTY_CONSOLE); let current_console = ctru_sys::consoleSelect(std::ptr::addr_of_mut!(EMPTY_CONSOLE));
if std::ptr::eq(current_console, &*self.context) { if std::ptr::eq(current_console, &*self.context) {
// Console dropped while selected. We just replaced it with the // Console dropped while selected. We just replaced it with the

Loading…
Cancel
Save