Browse Source

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

Sam Atkins 3 years ago
parent
commit
38bb9afea8
1 changed files with 3 additions and 0 deletions
  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);