OSDN Git Service

Fix crash
authorJohn Reck <jreck@google.com>
Thu, 8 Dec 2011 00:11:36 +0000 (16:11 -0800)
committerJohn Reck <jreck@google.com>
Thu, 8 Dec 2011 00:16:27 +0000 (16:16 -0800)
 Bug: 5727901

Change-Id: Ic2323eca6bc6e77fe428f3602800799e7b996cce

Source/WebKit/android/nav/WebView.cpp

index d3b9591..76f0fb8 100644 (file)
@@ -2108,11 +2108,14 @@ static int nativeFocusCandidateType(JNIEnv *env, jobject obj)
 
 static int nativeFocusCandidateLayerId(JNIEnv *env, jobject obj)
 {
-    const CachedFrame* frame;
+    const CachedFrame* frame = 0;
     const CachedNode* node = getFocusNode(env, obj, &frame);
-    if (!node)
+    if (!node || !frame)
+        return -1;
+    const CachedLayer* layer = frame->layer(node);
+    if (!layer)
         return -1;
-    return frame->layer(node)->uniqueId();
+    return layer->uniqueId();
 }
 
 static bool nativeFocusIsPlugin(JNIEnv *env, jobject obj)