summaryrefslogtreecommitdiffstats
path: root/chrome/browser/page_state.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/page_state.cc')
-rw-r--r--chrome/browser/page_state.cc13
1 files changed, 6 insertions, 7 deletions
diff --git a/chrome/browser/page_state.cc b/chrome/browser/page_state.cc
index f47a4cf..1d52ffb 100644
--- a/chrome/browser/page_state.cc
+++ b/chrome/browser/page_state.cc
@@ -40,16 +40,15 @@ void PageState::InitWithBytes(const std::string& bytes) {
state_.reset(new DictionaryValue);
JSONStringValueSerializer serializer(bytes);
- Value* root = NULL;
+ scoped_ptr<Value> root(serializer.Deserialize(NULL));
- if (!serializer.Deserialize(&root, NULL))
+ if (!root.get()) {
NOTREACHED();
-
- if (root != NULL && root->GetType() == Value::TYPE_DICTIONARY) {
- state_.reset(static_cast<DictionaryValue*>(root));
- } else if (root) {
- delete root;
+ return;
}
+
+ if (root->GetType() == Value::TYPE_DICTIONARY)
+ state_.reset(static_cast<DictionaryValue*>(root.release()));
}
void PageState::GetByteRepresentation(std::string* out) const {