commit | 9df77a3e6441df0810fe330623d46d9e0d49ebe1 | [log] [tgz] |
---|---|---|
author | Ching-Sung Li <chriscsli@google.com> | Wed Jul 10 11:45:30 2019 +0800 |
committer | Ching-Sung Li <chriscsli@google.com> | Fri Jul 12 11:17:56 2019 +0800 |
tree | 9a8b2a8bcded675c051adc227f45a500923fe95d | |
parent | dec38a243b8ae2abd7ec84587b8e33ae2a75058f [diff] [blame] |
Add @NonNull annotation to mark valid context parameter Background thread uses TileSizeCalculator might still run with Activity destroyed. Use @NonNull to mark valid context parameter before it's used to obtain system service. Bug: 136223173 Test: Manual Change-Id: Ib03f913197e119c1ba1e7a94c05411e65ced1a20
diff --git a/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java b/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java index 654ec13..a33bf97 100755 --- a/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java +++ b/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
@@ -645,7 +645,8 @@ } int getNumColumns() { - return TileSizeCalculator.getNumIndividualColumns(getActivity()); + Activity activity = getActivity(); + return activity == null ? 0 : TileSizeCalculator.getNumIndividualColumns(activity); } /**