Fixed two NPE.
Categories can technically be null, so need to guard for that when getting them from the ContentProvider. This occurred because I had an old index from before the change from "category" to "categories", so it indeed was null. The other one was from when I added a new repo without a fingerprint. The fingerprint gets changed to upper case, but if null, causes a NPE.
This commit is contained in:
		
							parent
							
								
									8bb0e58e6c
								
							
						
					
					
						commit
						4d5fd98ae5
					
				| @ -66,8 +66,11 @@ public class AppProvider extends FDroidProvider { | ||||
|             if (cursor != null) { | ||||
|                 cursor.moveToFirst(); | ||||
|                 while (!cursor.isAfterLast()) { | ||||
|                     for( String s : Utils.CommaSeparatedList.make(cursor.getString(0))) { | ||||
|                         categorySet.add(s); | ||||
|                     String categoriesString = cursor.getString(0); | ||||
|                     if (categoriesString != null) { | ||||
|                         for( String s : Utils.CommaSeparatedList.make(categoriesString)) { | ||||
|                             categorySet.add(s); | ||||
|                         } | ||||
|                     } | ||||
|                     cursor.moveToNext(); | ||||
|                 } | ||||
|  | ||||
| @ -407,7 +407,9 @@ public class RepoListFragment extends ListFragment | ||||
|     private void createNewRepo(String address, String fingerprint) { | ||||
|         ContentValues values = new ContentValues(2); | ||||
|         values.put(RepoProvider.DataColumns.ADDRESS, address); | ||||
|         values.put(RepoProvider.DataColumns.FINGERPRINT, fingerprint.toUpperCase(Locale.ENGLISH)); | ||||
|         if (fingerprint != null && fingerprint.length() > 0) { | ||||
|             values.put(RepoProvider.DataColumns.FINGERPRINT, fingerprint.toUpperCase(Locale.ENGLISH)); | ||||
|         } | ||||
|         RepoProvider.Helper.insert(getActivity(), values); | ||||
|         finishedAddingRepo(); | ||||
|     } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Peter Serwylo
						Peter Serwylo