From c1f691dff2fa7af96fbb51d4cdc83e9e84accdd0 Mon Sep 17 00:00:00 2001 From: Zijie He Date: Fri, 25 Aug 2017 10:39:23 -0700 Subject: [PATCH] Check whether on_screen is null before performing CFBooleanGetValue() A crash may randomly happen in IsWindowMinimized(), the potential reason is that |on_screen| is not retrieved from |window| with kCGWindowIsOnScreen property. So add a == NULL check before executing CFBooleanGetValue(). Bug: chromium:758554 Change-Id: I25ad1ddbb21ec049ef237e55a8d25156bcd982c7 Reviewed-on: https://chromium-review.googlesource.com/634043 Reviewed-by: Jamie Walch Commit-Queue: Zijie He Cr-Commit-Position: refs/heads/master@{#19527} --- webrtc/modules/desktop_capture/mac/window_list_utils.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webrtc/modules/desktop_capture/mac/window_list_utils.cc b/webrtc/modules/desktop_capture/mac/window_list_utils.cc index 88b8367d05..6fc697bd9b 100644 --- a/webrtc/modules/desktop_capture/mac/window_list_utils.cc +++ b/webrtc/modules/desktop_capture/mac/window_list_utils.cc @@ -141,7 +141,7 @@ bool IsWindowFullScreen( bool IsWindowMinimized(CFDictionaryRef window) { CFBooleanRef on_screen = reinterpret_cast( CFDictionaryGetValue(window, kCGWindowIsOnscreen)); - return !CFBooleanGetValue(on_screen); + return on_screen != NULL && !CFBooleanGetValue(on_screen); } // Returns true if the window is minimized.