Skip to content

Commit 77b6603

Browse files
committed
Defense programming to 2d dynamic scene manager.
1 parent 09d6f83 commit 77b6603

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

Assets/JCSUnity/Scripts/Managers/2D Game/JCS_2DDynamicSceneManager.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ public JCS_OrderLayer GetOrderLayerByOrderLayerIndex(int orderLayerIndex)
6868
{
6969
foreach (JCS_OrderLayer jcsol in mJCSOrderLayer)
7070
{
71+
if (jcsol == null)
72+
continue;
73+
7174
// find the order layer with the index passed in!
7275
if (jcsol.OrderLayer == orderLayerIndex)
7376
return jcsol;
7477
}
7578

76-
JCS_Debug.LogError(
77-
"Does not found the order layer u want.");
78-
7979
return null;
8080
}
8181

@@ -95,20 +95,20 @@ public void SetObjectParentToOrderLayerByOrderLayerIndex(JCS_OrderLayerObject jc
9595
/// <param name="orderLayerIndex"> index of scene layer </param>
9696
public void SetObjectParentToOrderLayerByOrderLayerIndex(ref JCS_OrderLayerObject jcsOlo, int orderLayerIndex)
9797
{
98-
// get the order layer by order layer index!
99-
JCS_OrderLayer jcsol = GetOrderLayerByOrderLayerIndex(orderLayerIndex);
100-
101-
if (jcsol == null)
98+
if (jcsOlo == null)
10299
{
103100
JCS_Debug.LogWarning(
104-
"Did not find the layer you willing to set to..., Layer: " + mJCSOrderLayer);
101+
"The 'JCS_OrderLayerObject' object you trying to set is null references...");
105102
return;
106103
}
107104

108-
if (jcsOlo == null)
105+
// get the order layer by order layer index!
106+
JCS_OrderLayer jcsol = GetOrderLayerByOrderLayerIndex(orderLayerIndex);
107+
108+
if (jcsol == null)
109109
{
110110
JCS_Debug.LogWarning(
111-
"The 'JCS_OrderLayerObject' object you trying to set is null references...");
111+
"Did not find the layer you willing to set to..., Layer Index: " + orderLayerIndex);
112112
return;
113113
}
114114

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Build from DESKTOP-5QUO247 at 12/5/2017 12:19:54 PM
1+
Build from DESKTOP-5QUO247 at 12/9/2017 5:56:40 AM

0 commit comments

Comments
 (0)