summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authordeymo <deymo@chromium.org>2016-02-16 20:18:18 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-17 04:20:15 +0000
commit0248a11f9e8299e198a01347a33f2a09a13f7f4d (patch)
treed90f15270fe1d679d2d7f64205e0f6109a307e9a /base
parenteee68fae914198693c60c9691b53f25b338560e7 (diff)
downloadchromium_src-0248a11f9e8299e198a01347a33f2a09a13f7f4d.zip
chromium_src-0248a11f9e8299e198a01347a33f2a09a13f7f4d.tar.gz
chromium_src-0248a11f9e8299e198a01347a33f2a09a13f7f4d.tar.bz2
Make MessageLoopForIO::current() failure explicit.
When calling MessageLoopForIO::current() without a message loop set and with debug checks enabled, a DCHECK() will dereference a null pointer causing the program to segfault. This patch makes the failure evident adding another DCHECK() with a clear message. BUG=None TEST=Build. Change-Id: If69d2e07d0bd93a78001be3e683159380bdd5ff1 Review URL: https://codereview.chromium.org/1703683002 Cr-Commit-Position: refs/heads/master@{#375788}
Diffstat (limited to 'base')
-rw-r--r--base/message_loop/message_loop.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h
index 499e194..ce960e1 100644
--- a/base/message_loop/message_loop.h
+++ b/base/message_loop/message_loop.h
@@ -630,6 +630,7 @@ class BASE_EXPORT MessageLoopForIO : public MessageLoop {
// Returns the MessageLoopForIO of the current thread.
static MessageLoopForIO* current() {
MessageLoop* loop = MessageLoop::current();
+ DCHECK(loop);
DCHECK_EQ(MessageLoop::TYPE_IO, loop->type());
return static_cast<MessageLoopForIO*>(loop);
}