Throw exceptions if trying to use client interfaces with no client

This commit is contained in:
Garry Newman 2019-08-17 11:52:56 +01:00
parent a7666d7d51
commit 3c2eeb7f2f
10 changed files with 27 additions and 0 deletions

View File

@ -200,5 +200,14 @@ namespace Steamworks
return SteamAPI.RestartAppIfNecessary( appid );
}
/// <summary>
/// Called in interfaces that rely on this being initialized
/// </summary>
internal static void ValidCheck()
{
if ( !IsValid )
throw new System.Exception( "SteamClient isn't initialized" );
}
}
}

View File

@ -17,6 +17,8 @@ namespace Steamworks
{
get
{
SteamClient.ValidCheck();
if ( _internal == null )
{
_internal = new ISteamFriends();

View File

@ -12,6 +12,8 @@ namespace Steamworks
{
get
{
SteamClient.ValidCheck();
if ( _internal == null )
{
_internal = new ISteamInput();

View File

@ -24,6 +24,8 @@ namespace Steamworks
{
get
{
SteamClient.ValidCheck();
if ( _internal == null )
{
_internal = new ISteamMatchmaking();

View File

@ -20,6 +20,8 @@ namespace Steamworks
{
get
{
SteamClient.ValidCheck();
if ( _internal == null )
{
_internal = new ISteamMusic();

View File

@ -17,6 +17,8 @@ namespace Steamworks
{
get
{
SteamClient.ValidCheck();
if ( _internal == null )
{
_internal = new ISteamParentalSettings();

View File

@ -17,6 +17,8 @@ namespace Steamworks
{
get
{
SteamClient.ValidCheck();
if ( _internal == null )
{
_internal = new ISteamScreenshots();

View File

@ -20,6 +20,8 @@ namespace Steamworks
{
get
{
SteamClient.ValidCheck();
if ( _internal == null )
{
_internal = new ISteamUser();

View File

@ -14,6 +14,8 @@ namespace Steamworks
{
get
{
SteamClient.ValidCheck();
if ( _internal == null )
{
_internal = new ISteamUserStats();

View File

@ -17,6 +17,8 @@ namespace Steamworks
{
get
{
SteamClient.ValidCheck();
if ( _internal == null )
{
_internal = new ISteamVideo();