Null checks to avoid NPEs (#1917) (#1918)

This commit is contained in:
Henrique Guedes 2018-10-31 05:25:49 -04:00 committed by Josephine Lim
parent 154f1622b2
commit 293cccd897
3 changed files with 12 additions and 3 deletions

View file

@ -263,6 +263,9 @@ public class CategoryImagesListFragment extends DaggerFragment {
* @return GridView Adapter
*/
public ListAdapter getAdapter() {
if(gridView == null) {
return null;
}
return gridView.getAdapter();
}

View file

@ -125,7 +125,9 @@ public class SearchImageFragment extends CommonsDaggerSupportFragment {
*/
public void updateImageList(String query) {
this.query = query;
imagesNotFoundView.setVisibility(GONE);
if(imagesNotFoundView != null) {
imagesNotFoundView.setVisibility(GONE);
}
if(!NetworkUtils.isInternetConnectionEstablished(getContext())) {
handleNoInternet();
return;

View file

@ -45,8 +45,12 @@ public class FileUtils {
e.printStackTrace();
} finally {
try {
out.close();
in.close();
if(out != null) {
out.close();
}
if(in != null) {
in.close();
}
} catch (IOException e) {
e.printStackTrace();
}