summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Dianne Hackborn <hackbod@google.com> 2013-02-12 00:44:26 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2013-02-12 00:44:26 +0000
commit681533e0005200a3e55782f7ffe8ef516c7099c3 (patch)
treecb3fe85241b5896cfd05c7fa93493794dffaf65f
parent1d3079cb8d477b50d5873e571695d938a6cb4712 (diff)
parente5b50a65ad26a32f6e58588ffdcbc0389eac9257 (diff)
Merge "Fix issue #8176917: Stabillity : Native Crash :"
-rw-r--r--core/java/android/content/res/Resources.java4
-rw-r--r--core/jni/android_util_AssetManager.cpp4
2 files changed, 8 insertions, 0 deletions
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index 777529394045..24a0bb532a8a 100644
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -792,6 +792,7 @@ public class Resources {
"Resource ID #0x" + Integer.toHexString(id) + " type #0x"
+ Integer.toHexString(value.type) + " is not valid");
}
+ mTmpValue = null;
}
ColorStateList csl = loadColorStateList(value, id);
synchronized (mAccessLock) {
@@ -2227,6 +2228,9 @@ public class Resources {
throws NotFoundException {
synchronized (mAccessLock) {
TypedValue value = mTmpValue;
+ if (value == null) {
+ mTmpValue = value = new TypedValue();
+ }
getValue(id, value, true);
if (value.type == TypedValue.TYPE_STRING) {
return loadXmlResourceParser(value.string.toString(), id,
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index d422951039e8..8a8b15fb9bbf 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -685,6 +685,10 @@ static jint android_content_AssetManager_loadResourceValue(JNIEnv* env, jobject
jobject outValue,
jboolean resolve)
{
+ if (outValue == null) {
+ jniThrowNullPointerException(env, "outValue");
+ return null;
+ }
AssetManager* am = assetManagerForJavaObject(env, clazz);
if (am == NULL) {
return 0;