diff options
author | Adam Cohen <adamcohen@google.com> | 2011-11-22 16:42:47 -0800 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2011-11-22 16:51:26 -0800 |
commit | d919882006a457d16dea46bd546472e6534b5c19 (patch) | |
tree | 0a207d19e6b9f57beb53d4bb65f5471eb39974b5 /src/com/android/launcher2/InstallShortcutReceiver.java | |
parent | d016015c2396b885a7ba30f3678d5c50830c20bd (diff) | |
download | android_packages_apps_Trebuchet-d919882006a457d16dea46bd546472e6534b5c19.tar.gz android_packages_apps_Trebuchet-d919882006a457d16dea46bd546472e6534b5c19.tar.bz2 android_packages_apps_Trebuchet-d919882006a457d16dea46bd546472e6534b5c19.zip |
Prevent the creation of Shorcuts with null intents (issue 5629292)
Change-Id: I54fbad2d4af27c6d8fc0d79c33e890298a3db4dc
Diffstat (limited to 'src/com/android/launcher2/InstallShortcutReceiver.java')
-rw-r--r-- | src/com/android/launcher2/InstallShortcutReceiver.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/com/android/launcher2/InstallShortcutReceiver.java b/src/com/android/launcher2/InstallShortcutReceiver.java index 9d7054cf4..ed8f29942 100644 --- a/src/com/android/launcher2/InstallShortcutReceiver.java +++ b/src/com/android/launcher2/InstallShortcutReceiver.java @@ -65,11 +65,15 @@ public class InstallShortcutReceiver extends BroadcastReceiver { boolean duplicate = data.getBooleanExtra(Launcher.EXTRA_SHORTCUT_DUPLICATE, true); if (duplicate || !LauncherModel.shortcutExists(context, name, intent)) { LauncherApplication app = (LauncherApplication) context.getApplicationContext(); - app.getModel().addShortcut(context, data, + ShortcutInfo info = app.getModel().addShortcut(context, data, LauncherSettings.Favorites.CONTAINER_DESKTOP, screen, mCoordinates[0], mCoordinates[1], true); - Toast.makeText(context, context.getString(R.string.shortcut_installed, name), - Toast.LENGTH_SHORT).show(); + if (info != null) { + Toast.makeText(context, context.getString(R.string.shortcut_installed, name), + Toast.LENGTH_SHORT).show(); + } else { + return false; + } } else { Toast.makeText(context, context.getString(R.string.shortcut_duplicate, name), Toast.LENGTH_SHORT).show(); |