summaryrefslogtreecommitdiffstats
path: root/WebKit/android
diff options
context:
space:
mode:
authorPatrick Scott <phanna@android.com>2009-11-30 10:42:28 -0500
committerPatrick Scott <phanna@android.com>2009-11-30 11:33:28 -0500
commitdb239ca3504af9998d5717708fdef4676e286602 (patch)
tree776330130c1aede3e11d96c7bd395552fd1a91ac /WebKit/android
parenta8aa6b7d72075facc6ca0672894b0f936669f341 (diff)
downloadexternal_webkit-db239ca3504af9998d5717708fdef4676e286602.zip
external_webkit-db239ca3504af9998d5717708fdef4676e286602.tar.gz
external_webkit-db239ca3504af9998d5717708fdef4676e286602.tar.bz2
Fix a crash when closing the native history.
The item for a given frame can be null when closing the history while reusing the same WebView. If the item is null, no need to visit the children since they will also not have a history item.
Diffstat (limited to 'WebKit/android')
-rw-r--r--WebKit/android/jni/WebHistory.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/WebKit/android/jni/WebHistory.cpp b/WebKit/android/jni/WebHistory.cpp
index 17aae52..0d469b4 100644
--- a/WebKit/android/jni/WebHistory.cpp
+++ b/WebKit/android/jni/WebHistory.cpp
@@ -122,9 +122,12 @@ static void WebHistoryClose(JNIEnv* env, jobject obj, jint frame)
// deleted parent.
WebCore::HistoryItem* item = parent->childItemWithTarget(child->tree()->name());
child->loader()->history()->setCurrentItem(item);
- // Append the first child to the queue if it exists.
- if (WebCore::Frame* f = child->tree()->firstChild())
- frameQueue.append(f);
+ // Append the first child to the queue if it exists. If there is no
+ // item, then we do not need to traverse the children since there
+ // will be no parent history item.
+ WebCore::Frame* firstChild;
+ if (item && (firstChild = child->tree()->firstChild()))
+ frameQueue.append(firstChild);
child = child->tree()->nextSibling();
// If we don't have a sibling for this frame and the queue isn't
// empty, use the next entry in the queue.