Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: Source/modules/gamepad/NavigatorGamepad.cpp

Issue 1308723003: DOMWindow::navigator should return navigator w/o frame when detached. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/gamepad/NavigatorGamepad.cpp
diff --git a/Source/modules/gamepad/NavigatorGamepad.cpp b/Source/modules/gamepad/NavigatorGamepad.cpp
index f6673f8978ec4774810f5c0bcf4ecc3fa52876d8..00f6cb8f9f7ceb15209cc08ee86479725e53efdf 100644
--- a/Source/modules/gamepad/NavigatorGamepad.cpp
+++ b/Source/modules/gamepad/NavigatorGamepad.cpp
@@ -73,9 +73,11 @@ static void sampleGamepads(ListType* into)
NavigatorGamepad* NavigatorGamepad::from(Document& document)
{
if (!document.frame() || !document.frame()->domWindow())
- return 0;
- Navigator& navigator = *document.frame()->domWindow()->navigator();
- return &from(navigator);
+ return nullptr;
+ Navigator* navigator = document.frame()->domWindow()->navigator();
+ if (!navigator)
+ return nullptr;
+ return &from(*navigator);
}
NavigatorGamepad& NavigatorGamepad::from(Navigator& navigator)

Powered by Google App Engine
This is Rietveld 408576698