Skip to content

Commit 06b8445

Browse files
committed
Fixed NullRefs on NetworkedBehaviour property
1 parent c2c4da9 commit 06b8445

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

MLAPI/MonoBehaviours/Core/NetworkedBehaviour.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ public abstract class NetworkedBehaviour : MonoBehaviour
3030
/// <summary>
3131
/// Gets if we are executing as server
3232
/// </summary>
33-
protected bool isServer => isRunning && NetworkingManager.singleton.isServer;
33+
protected bool isServer => isRunning && NetworkingManager.singleton != null && NetworkingManager.singleton.isServer;
3434
/// <summary>
3535
/// Gets if we are executing as client
3636
/// </summary>
37-
protected bool isClient => isRunning && NetworkingManager.singleton.isClient;
37+
protected bool isClient => isRunning && NetworkingManager.singleton != null && NetworkingManager.singleton.isClient;
3838
/// <summary>
3939
/// Gets if we are executing as Host, I.E Server and Client
4040
/// </summary>
41-
protected bool isHost => isRunning && NetworkingManager.singleton.isHost;
42-
private bool isRunning => NetworkingManager.singleton == null || NetworkingManager.singleton.isListening;
41+
protected bool isHost => isRunning && NetworkingManager.singleton != null && NetworkingManager.singleton.isHost;
42+
private bool isRunning => NetworkingManager.singleton != null && (NetworkingManager.singleton == null || NetworkingManager.singleton.isListening);
4343
/// <summary>
4444
/// Gets wheter or not the object has a owner
4545
/// </summary>

0 commit comments

Comments
 (0)