Skip to content

Commit ac5bfbb

Browse files
committed
add throw exception when object is null
1 parent 1340f18 commit ac5bfbb

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/UQuery.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ public static T SelectByPath<T>(string path) where T : class
6767
{
6868
if(!keys.Any())
6969
break;
70-
target = target.Child(keys.Pop());
70+
var key = keys.Pop();
71+
target = target.Child(key);
72+
if (target is null)
73+
throw new GameObjectNotFoundByPath(key, path);
7174
}
7275

7376
if (@class is null)

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.ivysola.uquery",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"displayName": "uquery",
55
"description": "Library for querying unity gameobject",
66
"unity": "2020.2",

0 commit comments

Comments
 (0)