Skip to content

Commit 8c2f3ba

Browse files
committed
优化框架内部 findViewById 方法判空
1 parent 19b54f0 commit 8c2f3ba

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

library/src/main/java/com/hjq/window/EasyWindow.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1248,9 +1248,12 @@ public int getViewHeight() {
12481248
}
12491249

12501250
/**
1251-
* 根据 ViewId 获取 View
1251+
* 根据 ViewId 获取 View(返回可能为空)
12521252
*/
12531253
public <V extends View> V findViewById(int id) {
1254+
if (mDecorView == null) {
1255+
return null;
1256+
}
12541257
return mDecorView.findViewById(id);
12551258
}
12561259

0 commit comments

Comments
 (0)