增加空判断
This commit is contained in:
parent
d69bb45c4d
commit
d8b56b667a
@ -41,8 +41,8 @@ public class DeviceController : MonoSingleton<DeviceController>
|
|||||||
if (string.IsNullOrEmpty(device.Path) == false)
|
if (string.IsNullOrEmpty(device.Path) == false)
|
||||||
{
|
{
|
||||||
obj = Utility.FindObj(device.Path);
|
obj = Utility.FindObj(device.Path);
|
||||||
item = obj.GetOrAddComponent<DeviceItem>();
|
item = obj?.GetOrAddComponent<DeviceItem>();
|
||||||
item.Init(device);
|
item?.Init(device);
|
||||||
}
|
}
|
||||||
deviceDict.Add(device.Name, new DeviceData() { device = device, item = item });
|
deviceDict.Add(device.Name, new DeviceData() { device = device, item = item });
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user