From 824a8291ea22a08187cd377d87e08faa6c429e4a Mon Sep 17 00:00:00 2001 From: sneurlax Date: Wed, 16 Oct 2024 21:42:04 -0500 Subject: handle null wallet ptr case --- impls/monero.rs/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'impls/monero.rs') diff --git a/impls/monero.rs/src/lib.rs b/impls/monero.rs/src/lib.rs index b50b8f2..2f08cd9 100644 --- a/impls/monero.rs/src/lib.rs +++ b/impls/monero.rs/src/lib.rs @@ -85,6 +85,10 @@ impl WalletManager { /// std::fs::remove_file(format!("{}.keys", wallet_str)).expect("Failed to delete test wallet keys"); /// ``` pub fn get_status(&self, wallet_ptr: *mut c_void) -> WalletResult<()> { + if wallet_ptr.is_null() { + return Err(WalletError::NullPointer); // Ensure NullPointer is returned for null wallet + } + unsafe { let status = bindings::MONERO_Wallet_status(wallet_ptr); if status == bindings::WalletStatus_Ok { -- cgit v1.2.3