Skip to content

Commit 6c5d6c2

Browse files
AriesHooAriesHoo
AriesHoo
authored and
AriesHoo
committed
upgrade androidx
优化:FastUtil类getRootView方法逻辑避免空指针异常
1 parent 1e19245 commit 6c5d6c2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

library/src/main/java/com/aries/library/fast/util/FastUtil.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
* 1、将startActivity 参数Activity 改为Context
3434
* 2、2018-7-23 09:29:55 新增获取App 应用名称方法
3535
* 3、2019-2-15 11:28:53 修改startActivity 方法增加single tag设置方法{@link #setActivitySingleFlag(int)}
36+
* 4、2019-2-22 13:49:12 修改{@link #getRootView(Activity)} 判断逻辑
3637
*/
3738
public class FastUtil {
3839

@@ -91,6 +92,9 @@ public static View getRootView(Activity activity) {
9192
if (activity == null) {
9293
return null;
9394
}
95+
if (activity.findViewById(android.R.id.content) == null) {
96+
return null;
97+
}
9498
return ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0);
9599
}
96100

0 commit comments

Comments
 (0)