浏览代码

Browser: Don't crash when selecting nothing in the Inspector DOM tree

Sam Atkins 3 年之前
父节点
当前提交
38bb9afea8
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      Userland/Applications/Browser/InspectorWidget.cpp

+ 3 - 0
Userland/Applications/Browser/InspectorWidget.cpp

@@ -43,6 +43,9 @@ void InspectorWidget::set_selection(Selection selection)
 
 void InspectorWidget::set_selection(GUI::ModelIndex const index)
 {
+    if (!index.is_valid())
+        return;
+
     auto* json = static_cast<JsonObject const*>(index.internal_data());
     VERIFY(json);