Fix crash in AutomationAXTreeWrapper::IsDesktopTree

Bug: 935963
Test: manual.
Change-Id: I7db0bc37d8085ac3f812818542d1a9dd6f8465de
Reviewed-on: https://chromium-review.googlesource.com/c/1489533
Auto-Submit: David Tseng <dtseng@chromium.org>
Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635682}
diff --git a/chrome/renderer/extensions/automation_ax_tree_wrapper.cc b/chrome/renderer/extensions/automation_ax_tree_wrapper.cc
index c315c43..ea7ec71a 100644
--- a/chrome/renderer/extensions/automation_ax_tree_wrapper.cc
+++ b/chrome/renderer/extensions/automation_ax_tree_wrapper.cc
@@ -317,7 +317,8 @@
 }
 
 bool AutomationAXTreeWrapper::IsDesktopTree() const {
-  return tree_.root()->data().role == ax::mojom::Role::kDesktop;
+  return tree_.root() ? tree_.root()->data().role == ax::mojom::Role::kDesktop
+                      : false;
 }
 
 void AutomationAXTreeWrapper::OnNodeDataWillChange(