diff options
| author | William Venner <[email protected]> | 2021-03-01 22:29:27 +0000 |
|---|---|---|
| committer | William Venner <[email protected]> | 2021-03-01 22:29:27 +0000 |
| commit | 650ba74c4a6d295478ae103cf36764e74d512647 (patch) | |
| tree | 277131b47350f62f284e2fae50d910c3787a4804 | |
| parent | Merge pull request #33 from WilliamVenner/ugc-stats (diff) | |
| download | archived-steamworks-rs-650ba74c4a6d295478ae103cf36764e74d512647.tar.xz archived-steamworks-rs-650ba74c4a6d295478ae103cf36764e74d512647.zip | |
Improve safety of ugc::query_user
| -rw-r--r-- | src/ugc.rs | 25 |
1 files changed, 14 insertions, 11 deletions
@@ -445,8 +445,8 @@ impl <Manager> UGC<Manager> { appids: AppIDs, page: u32 ) -> Result<UserListQuery<Manager>, CreateQueryError> { - unsafe { - let res = sys::SteamAPI_ISteamUGC_CreateQueryUserUGCRequest( + let res = unsafe { + sys::SteamAPI_ISteamUGC_CreateQueryUserUGCRequest( self.ugc, account.0, list_type.into(), @@ -455,16 +455,19 @@ impl <Manager> UGC<Manager> { appids.creator_app_id().unwrap_or(AppId(0)).0, appids.consumer_app_id().unwrap_or(AppId(0)).0, page, - ); - if res == UGCQueryHandleInvalid { - return Err(CreateQueryError); - } + ) + }; - Ok(UserListQuery { - ugc: self.ugc, - inner: Arc::clone(&self.inner), - handle: Some(res), - }) + if res == UGCQueryHandleInvalid { + return Err(CreateQueryError); + } + + Ok(UserListQuery { + ugc: self.ugc, + inner: Arc::clone(&self.inner), + handle: Some(res), + }) + } } } } |