summaryrefslogtreecommitdiffstats
path: root/ios
diff options
context:
space:
mode:
authorsdefresne <sdefresne@chromium.org>2015-04-20 09:36:41 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-20 16:36:43 +0000
commit3c787ac163f1da85dfc0d40aa89ad2828081560c (patch)
tree7300026eb2655f7660f1396c80ea327483c0b798 /ios
parentee935e25af1eefd0b786e6801bbec74e323638ab (diff)
downloadchromium_src-3c787ac163f1da85dfc0d40aa89ad2828081560c.zip
chromium_src-3c787ac163f1da85dfc0d40aa89ad2828081560c.tar.gz
chromium_src-3c787ac163f1da85dfc0d40aa89ad2828081560c.tar.bz2
Prevent passing null to CreateForWebState()
DCHECK that WebStateUserData::CreateForWebState receives a valid WebState to avoid dereferencing nullptr. BUG=None Review URL: https://codereview.chromium.org/1099653002 Cr-Commit-Position: refs/heads/master@{#325858}
Diffstat (limited to 'ios')
-rw-r--r--ios/web/public/web_state/web_state_user_data.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/ios/web/public/web_state/web_state_user_data.h b/ios/web/public/web_state/web_state_user_data.h
index d1dc0d2..61145b9 100644
--- a/ios/web/public/web_state/web_state_user_data.h
+++ b/ios/web/public/web_state/web_state_user_data.h
@@ -5,6 +5,7 @@
#ifndef IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_USER_DATA_H_
#define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_USER_DATA_H_
+#include "base/logging.h"
#include "base/supports_user_data.h"
#include "ios/web/public/web_state/web_state.h"
@@ -32,6 +33,7 @@ class WebStateUserData : public base::SupportsUserData::Data {
// Creates an object of type T, and attaches it to the specified WebState.
// If an instance is already attached, does nothing.
static void CreateForWebState(WebState* web_state) {
+ DCHECK(web_state);
if (!FromWebState(web_state))
web_state->SetUserData(UserDataKey(), new T(web_state));
}