diff --git a/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc b/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc index 9cb3681fd..dc10eceb7 100644 --- a/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc +++ b/webrtc/modules/desktop_capture/win/screen_capturer_win_gdi.cc @@ -133,7 +133,8 @@ void ScreenCapturerWinGdi::Capture(const DesktopRegion& region) { callback_->OnCaptureCompleted(frame); // Check for cursor shape update. - CaptureCursor(); + if (mouse_shape_observer_) + CaptureCursor(); } void ScreenCapturerWinGdi::SetMouseShapeObserver( @@ -279,6 +280,8 @@ bool ScreenCapturerWinGdi::CaptureImage() { } void ScreenCapturerWinGdi::CaptureCursor() { + assert(mouse_shape_observer_); + CURSORINFO cursor_info; cursor_info.cbSize = sizeof(CURSORINFO); if (!GetCursorInfo(&cursor_info)) { @@ -317,8 +320,7 @@ void ScreenCapturerWinGdi::CaptureCursor() { // Record the last cursor image that we sent to the client. last_cursor_ = *cursor; - if (mouse_shape_observer_) - mouse_shape_observer_->OnCursorShapeChanged(cursor.release()); + mouse_shape_observer_->OnCursorShapeChanged(cursor.release()); } } // namespace webrtc