From c4c2c8a597444e747df229e30e9074e747f3ceee Mon Sep 17 00:00:00 2001 From: Hussein Ait Lahcen Date: Fri, 25 Oct 2024 23:13:43 +0200 Subject: [PATCH] fix(gns): init error is cstr --- gns/src/lib.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/gns/src/lib.rs b/gns/src/lib.rs index 476d6ff..474ab70 100644 --- a/gns/src/lib.rs +++ b/gns/src/lib.rs @@ -134,10 +134,7 @@ impl GnsGlobal { let mut error: SteamDatagramErrMsg = MaybeUninit::zeroed().assume_init(); if !GameNetworkingSockets_Init(core::ptr::null(), &mut error) { GNS_INIT.store(false, std::sync::atomic::Ordering::SeqCst); - Err(format!( - "{}", - core::str::from_utf8_unchecked(core::mem::transmute(&error[..])) - )) + Err(format!("{}", CStr::from_ptr(error.as_ptr()))) } else { Ok(GnsGlobal(())) }