Skip to content

Commit bb7a85a

Browse files
committed
Remove invalid null checks
1 parent 5af68c3 commit bb7a85a

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

com.unity.netcode.gameobjects/Editor/Configuration/NetcodeForGameObjectsProjectSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class NetcodeForGameObjectsProjectSettings : ScriptableSingleton<NetcodeF
2222

2323
private void OnEnable()
2424
{
25-
if (NetworkPrefabsPath?.Length == 0)
25+
if (NetworkPrefabsPath.Length == 0)
2626
{
2727
NetworkPrefabsPath = DefaultNetworkPrefabsPath;
2828
}

com.unity.netcode.gameobjects/Editor/Configuration/NetcodeSettingsProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private static void OnDeactivate()
3636
if (settings.TempNetworkPrefabsPath != settings.NetworkPrefabsPath)
3737
{
3838
var newPath = settings.TempNetworkPrefabsPath;
39-
if (newPath?.Length == 0)
39+
if (newPath.Length == 0)
4040
{
4141
newPath = NetcodeForGameObjectsProjectSettings.DefaultNetworkPrefabsPath;
4242
settings.TempNetworkPrefabsPath = newPath;

com.unity.netcode.gameobjects/Editor/HiddenScriptEditor.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public class UnityTransportEditor : HiddenScriptEditor
5555

5656
private SerializedProperty m_ServerAddressProperty;
5757
private SerializedProperty m_ServerPortProperty;
58-
private SerializedProperty m_OverrideBindIpProperty;
5958

6059
private const string k_LoopbackIpv4 = "127.0.0.1";
6160
private const string k_LoopbackIpv6 = "::1";
@@ -76,7 +75,7 @@ private void Initialize()
7675

7776
m_ServerAddressProperty = connectionDataProperty.FindPropertyRelative(nameof(UnityTransport.ConnectionAddressData.Address));
7877
m_ServerPortProperty = connectionDataProperty.FindPropertyRelative(nameof(UnityTransport.ConnectionAddressData.Port));
79-
m_OverrideBindIpProperty = connectionDataProperty.FindPropertyRelative(nameof(UnityTransport.ConnectionAddressData.ServerListenAddress));
78+
connectionDataProperty.FindPropertyRelative(nameof(UnityTransport.ConnectionAddressData.ServerListenAddress));
8079
}
8180

8281
/// <summary>
@@ -129,7 +128,7 @@ public override void OnInspectorGUI()
129128
overrideIp = EditorGUILayout.TextField("Override Bind IP (optional)", overrideIp);
130129
if (allowRemoteConnections)
131130
{
132-
if (overrideIp?.Length == 0)
131+
if (overrideIp.Length == 0)
133132
{
134133
if (isIpV6)
135134
{

com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,12 @@ private void DisplayNetworkManagerProperties()
251251
// Default directory
252252
var directory = "Assets/";
253253
var assetPath = AssetDatabase.GetAssetPath(m_NetworkManager);
254-
if (assetPath?.Length == 0)
254+
if (assetPath.Length == 0)
255255
{
256256
assetPath = PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot(m_NetworkManager);
257257
}
258258

259-
if (assetPath != "")
259+
if (assetPath.Length > 0)
260260
{
261261
directory = Path.GetDirectoryName(assetPath);
262262
}
@@ -270,7 +270,7 @@ private void DisplayNetworkManagerProperties()
270270
if (prefabStage != null)
271271
{
272272
var prefabPath = prefabStage.assetPath;
273-
if (!string.IsNullOrEmpty(prefabPath))
273+
if (prefabPath.Length > 0)
274274
{
275275
directory = Path.GetDirectoryName(prefabPath);
276276
}

0 commit comments

Comments
 (0)