bugfix : npe

This commit is contained in:
wangcongtao
2020-09-17 10:17:43 +08:00
parent 749b721720
commit 79d70532dd

View File

@@ -87,7 +87,7 @@ public class AppsModel {
continue;
}
int page = counter++ / AppsConst.TOTAL_SIZE_EACH_PAGE;
if ( !mPagedApps.containsKey( page ) ) {
if ( mPagedApps.get( page ) == null ) {
mPagedApps.put( page, new ArrayList<>() );
}
String appName = getApplicationName( packageManager, packageInfo );
@@ -131,7 +131,7 @@ public class AppsModel {
Drawable appIcon = packageInfo.applicationInfo.loadIcon( packageManager );
AppInfo appInfo = new AppInfo( appName, packageName, versionName, versionCode, appIcon, AppEnumHelper.getCustomizedAppIconResId( packageName ) );
int pageIndex = getPageIndex( packageName, true );
if ( !mPagedApps.containsKey( pageIndex ) ) {
if ( mPagedApps.get( pageIndex ) == null ) {
mPagedApps.put( pageIndex, new ArrayList<>() );
}
mPagedApps.get( pageIndex ).add( appInfo );
@@ -205,7 +205,7 @@ public class AppsModel {
continue;
}
int page = counter++ / AppsConst.TOTAL_SIZE_EACH_PAGE + pageIndex;
if ( !mPagedApps.containsKey( page ) ) {
if ( mPagedApps.get( page ) == null ) {
mPagedApps.put( page, new ArrayList<>() );
}
mPagedApps.get( page ).add( appInfo );