From 1c0f21ea8475f9996dbd7400725969ec5ffdc005 Mon Sep 17 00:00:00 2001 From: Allen Shen Date: Tue, 29 Apr 2014 16:16:29 +0800 Subject: [PATCH] WallpaperManager: add NULL pointer check for getCropAndSetWallpaperIntent Originally the api 'getCropAndSetWallpaperIntent' does not check whether the parsed parameter is a NULL pointer, as leads to the whole app crash if it call this api with a null parameter accidentally. A null pointer check logic is added into its original parameter check logic, so that this API will throw an IllegalArgumentException if it is parsed with a null pointer Change-Id: Ib7de40e571419d09e1a744edc969eb7162766b75 --- core/java/android/app/WallpaperManager.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java index ced72f80a0295..c2bbff0e743a5 100644 --- a/core/java/android/app/WallpaperManager.java +++ b/core/java/android/app/WallpaperManager.java @@ -668,6 +668,10 @@ public class WallpaperManager { * not "image/*" */ public Intent getCropAndSetWallpaperIntent(Uri imageUri) { + if (imageUri == null) { + throw new IllegalArgumentException("Image URI must not be null"); + } + if (!ContentResolver.SCHEME_CONTENT.equals(imageUri.getScheme())) { throw new IllegalArgumentException("Image URI must be of the " + ContentResolver.SCHEME_CONTENT + " scheme type");