summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/util/ComponentKey.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher3/util/ComponentKey.java')
-rw-r--r--src/com/android/launcher3/util/ComponentKey.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/com/android/launcher3/util/ComponentKey.java b/src/com/android/launcher3/util/ComponentKey.java
index 6a7df4318..b7aafaea9 100644
--- a/src/com/android/launcher3/util/ComponentKey.java
+++ b/src/com/android/launcher3/util/ComponentKey.java
@@ -64,8 +64,11 @@ public class ComponentKey {
* Encodes a component key as a string of the form [flattenedComponentString#userId].
*/
public String flattenToString(Context context) {
- return componentName.flattenToString() + "#" +
- UserManagerCompat.getInstance(context).getSerialNumberForUser(user);
+ String flattened = componentName.flattenToString();
+ if (user != null) {
+ flattened += "#" + UserManagerCompat.getInstance(context).getSerialNumberForUser(user);
+ }
+ return flattened;
}
@Override