Browse Source

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

Sam Atkins 3 năm trước cách đây
mục cha
commit
38bb9afea8

+ 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)
 void InspectorWidget::set_selection(GUI::ModelIndex const index)
 {
 {
+    if (!index.is_valid())
+        return;
+
     auto* json = static_cast<JsonObject const*>(index.internal_data());
     auto* json = static_cast<JsonObject const*>(index.internal_data());
     VERIFY(json);
     VERIFY(json);