Index: Source/modules/screen_orientation/ScreenOrientation.cpp |
diff --git a/Source/modules/screen_orientation/ScreenOrientation.cpp b/Source/modules/screen_orientation/ScreenOrientation.cpp |
index f9722624331e99b722cb76c08cbe50c1dd840143..896fc9ed6be14dfe863d063544b587ce06267211 100644 |
--- a/Source/modules/screen_orientation/ScreenOrientation.cpp |
+++ b/Source/modules/screen_orientation/ScreenOrientation.cpp |
@@ -88,6 +88,12 @@ ScreenOrientation* ScreenOrientation::create(LocalFrame* frame) |
{ |
ASSERT(frame); |
+ // Check if the ScreenOrientationController is supported for the |
+ // frame. It will not be for all LocalFrames, or the frame may |
+ // have been detached. |
+ if (!ScreenOrientationController::from(*frame)) |
+ return nullptr; |
+ |
ScreenOrientation* orientation = new ScreenOrientation(frame); |
ASSERT(orientation->controller()); |
// FIXME: ideally, we would like to provide the ScreenOrientationController |