summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-03-11 16:40:12 +0000
committerAndreas Kling <kling@serenityos.org>2022-03-11 19:31:59 +0100
commit38bb9afea863efda1e25e16e9a3352a7d4195e63 (patch)
tree0be303c14b56dc1d66a39b31953eb206d4d7d3d7 /Userland/Applications
parent332799fbcbd97f2be5ea9afef9d2f1cd3c2b090b (diff)
downloadserenity-38bb9afea863efda1e25e16e9a3352a7d4195e63.zip
Browser: Don't crash when selecting nothing in the Inspector DOM tree
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/Browser/InspectorWidget.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Applications/Browser/InspectorWidget.cpp b/Userland/Applications/Browser/InspectorWidget.cpp
index 488f35c8ef..bcd1abc7b0 100644
--- a/Userland/Applications/Browser/InspectorWidget.cpp
+++ b/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);