Просмотр исходного кода

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

Sam Atkins 3 лет назад
Родитель
Сommit
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);