summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/WebKit/android/jni/WebHistory.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/Source/WebKit/android/jni/WebHistory.cpp b/Source/WebKit/android/jni/WebHistory.cpp
index baafa00..c06244b 100644
--- a/Source/WebKit/android/jni/WebHistory.cpp
+++ b/Source/WebKit/android/jni/WebHistory.cpp
@@ -472,10 +472,13 @@ static void writeItem(WTF::Vector<char>& vector, WebCore::HistoryItem* item)
// Form data
const WebCore::FormData* formData = item->formData();
if (formData) {
- writeString(vector, formData->flattenToString());
- // save the identifier as it is not included in the flatten data
- int64_t id = formData->identifier();
- vector.append((char*)&id, sizeof(int64_t));
+ WTF::String flattenedFormData = formData->flattenToString();
+ writeString(vector, flattenedFormData);
+ if (!flattenedFormData.isEmpty()) {
+ // save the identifier as it is not included in the flatten data
+ int64_t id = formData->identifier();
+ vector.append((char*)&id, sizeof(int64_t));
+ }
} else
writeString(vector, WTF::String()); // Empty constructor does not allocate a buffer.