1From 317fd980dd9504d3fe321b53469fee79e3276fed Mon Sep 17 00:00:00 2001
2From: Ryo Hashimoto <hashimoto@chromium.org>
3Date: Thu, 4 Oct 2018 05:04:22 +0000
4Subject: [PATCH] Mojo: Check if dispatcher is null in
5 Core::UnwrapPlatformHandle()
6
7The same check is done in other functions in this .cc file.
8Do the same thing for UnwrapPlatformHandle().
9
10BUG=891990
11TEST=mojo_unittests
12
13Change-Id: I05fe4bfd5edd8ec3fc67aeb9f11879c74fd71dd4
14Reviewed-on: https://chromium-review.googlesource.com/c/1260782
15Reviewed-by: Ken Rockot <rockot@chromium.org>
16Commit-Queue: Ryo Hashimoto <hashimoto@chromium.org>
17Cr-Commit-Position: refs/heads/master@{#596510}
18---
19 mojo/core/core.cc | 3 ++-
20 1 file changed, 2 insertions(+), 1 deletion(-)
21
22diff --git a/mojo/core/core.cc b/mojo/core/core.cc
23index 8422ec247a40..32ecea3eae55 100644
24--- a/mojo/core/core.cc
25+++ b/mojo/core/core.cc
26@@ -1017,7 +1017,8 @@ MojoResult Core::UnwrapPlatformHandle(
27   {
28     base::AutoLock lock(handles_->GetLock());
29     dispatcher = handles_->GetDispatcher(mojo_handle);
30-    if (dispatcher->GetType() != Dispatcher::Type::PLATFORM_HANDLE)
31+    if (!dispatcher ||
32+        dispatcher->GetType() != Dispatcher::Type::PLATFORM_HANDLE)
33       return MOJO_RESULT_INVALID_ARGUMENT;
34
35     MojoResult result =
36--
372.25.0.225.g125e21ebc7-goog
38
39