mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 09:54:35 +08:00
add inject null check
This commit is contained in:
parent
840ccb2782
commit
7b5c912ebd
@ -2,6 +2,7 @@
|
|||||||
using DCFApixels.DragonECS.RunnersCore;
|
using DCFApixels.DragonECS.RunnersCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
{
|
{
|
||||||
@ -58,9 +59,12 @@ namespace DCFApixels.DragonECS
|
|||||||
private EcsBaseTypeInjectRunner _baseTypeInjectRunner;
|
private EcsBaseTypeInjectRunner _baseTypeInjectRunner;
|
||||||
void IEcsInject<T>.Inject(T obj)
|
void IEcsInject<T>.Inject(T obj)
|
||||||
{
|
{
|
||||||
|
if (obj == null) ThrowArgumentNullException();
|
||||||
_baseTypeInjectRunner.Inject(obj);
|
_baseTypeInjectRunner.Inject(obj);
|
||||||
foreach (var item in targets) item.Inject(obj);
|
foreach (var item in targets) item.Inject(obj);
|
||||||
}
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
private void ThrowArgumentNullException() => throw new ArgumentNullException();
|
||||||
protected override void OnSetup()
|
protected override void OnSetup()
|
||||||
{
|
{
|
||||||
Type baseType = typeof(T).BaseType;
|
Type baseType = typeof(T).BaseType;
|
||||||
|
Loading…
Reference in New Issue
Block a user